gruntwork-io / git-xargs

git-xargs is a command-line tool (CLI) for making updates across multiple Github repositories with a single command.
https://blog.gruntwork.io/introducing-git-xargs-an-open-source-tool-to-update-multiple-github-repos-753f9f3675ec
Apache License 2.0
935 stars 62 forks source link

Not pushing file to repo #41

Closed marshall7m closed 2 years ago

marshall7m commented 3 years ago

git-xargs version What does git-xargs --version show? v0.0.10 Describe the bug A clear and concise description of what the bug is. I'm trying to push a blank file via git-xargs on a repository that I own.

To Reproduce Steps to reproduce the behavior:

  1. Run this command... export GITHUB_OAUTH_TOKEN=xxx
    git-xargs --repo marshall7m/terraform-aws-github-ci --branch-name master --commit-message "add blank file" --skip-pull-requests touch foo.txt
  2. See error:
[git-xargs] INFO[2021-06-02T09:41:25-07:00] git-xargs running...                         

*****************************************************************
  GIT-XARGS RUN SUMMARY @ 2021-06-02 16:41:26.996364 +0000 UTC
  Runtime in seconds: 1
*****************************************************************

COMMAND SUPPLIED

[touch foo.txt]

 ALL REPOS THAT WERE TARGETED FOR PROCESSING AFTER FILTERING MISSING / MALFORMED REPOS
│─────────────────────────│───────────────────────────────────────────────────────│
│ REPO NAME               │ REPO URL                                              │
│─────────────────────────│───────────────────────────────────────────────────────│
│ terraform-aws-github-ci │ https://github.com/marshall7m/terraform-aws-github-ci │
│─────────────────────────│───────────────────────────────────────────────────────│

 REPOS THAT WERE SUCCESSFULLY CLONED TO THE LOCAL FILESYSTEM
│─────────────────────────│───────────────────────────────────────────────────────│
│ REPO NAME               │ REPO URL                                              │
│─────────────────────────│───────────────────────────────────────────────────────│
│ terraform-aws-github-ci │ https://github.com/marshall7m/terraform-aws-github-ci │
│─────────────────────────│───────────────────────────────────────────────────────│

 REPOS FOR WHICH CHECKING OUT A NEW TOOL-SPECIFIC BRANCH FAILED
│─────────────────────────│───────────────────────────────────────────────────────│
│ REPO NAME               │ REPO URL                                              │
│─────────────────────────│───────────────────────────────────────────────────────│
│ terraform-aws-github-ci │ https://github.com/marshall7m/terraform-aws-github-ci │
│─────────────────────────│───────────────────────────────────────────────────────│

Expected behavior A clear and concise description of what you expected to happen.

Expected foo.txt to be pushed to target repo's master branch Additional context Add any other context about the problem here.

zackproser commented 3 years ago

Hi @marshall7m ,

It looks like you already have a master branch for the marshall7m/terraform-aws-github-ci repo. If you re-run your command while passing the --loglevel debug flag you will see the more verbose error message at runtime:

git-xargs --loglevel debug --repo zack-test-org/terraform-aws-eks --branch-name master --commit-message "add blank file" --skip-pull-requests touch foo.txt
Total 195 (delta 159), reused 27 (delta 11), pack-reused 17  Repo=terraform-aws-eks            
[git-xargs] DEBU[2021-06-29T12:11:31-04:00] Created branch                                Branc
h Name=refs/heads/master Repo=terraform-aws-eks                                                
[git-xargs] DEBU[2021-06-29T12:11:31-04:00] Error creating new branch                     Error
="a branch named \"refs/heads/master\" already exists" Repo=terraform-aws-eks                  
[git-xargs] DEBU[2021-06-29T12:11:31-04:00] Error encountered while processing repo       Error
="a branch named \"refs/heads/master\" already exists" Repo name=terraform-aws-eks   

Could you please try again while passing the name of a new branch for git-xargs to create?

zackproser commented 2 years ago

I'm going to close this issue out due to inactivity and inability to reproduce, but please feel free to re-open if I've misunderstood the problem. Thanks!

RisingOrange commented 2 years ago

I have the same problem as @marshall7m I am trying to push changes directly to the existing master branch, but git-xargs shows an error that this branch already exists.

The readme suggest that it is possible to provide a branch that already exists for the --branch-name argument. "If you specify the name of a branch that exists on your remote, its latest changes will be pulled locally prior to your command or script being run." https://github.com/gruntwork-io/git-xargs#branch-behavior

This would be very useful if it worked correctly, because if you have a lot of repositories and use git-xargs you still have to accept all the pull requests manually.