I cloned a repository from a github enterprise remote with the option "--mirror".
I'd like to push that repo in another remote repository but i've the following error:
> ! [remote failure] XXXX-7342f50b84fbfff3a2bbdcf81481dbcb2d88e5cd -> XXXX-7342f50b84fbfff3a2bbdcf81481dbcb2d88e5cd (remote failed to report status)
> error: failed to push some refs to '[email protected]:XXXX/YYYY.git'
> Branch master set up to track remote branch master from origin.
How to Fix error: failed to push some refs to Error in Git Using git pull. To send a pull request means to "fetch" new changes made to the remote repo and merge them with the local repo. Once the merging is done, you can then push your own code changes to GitHub.
To fix this issue, run git pull on your local repository. This should allow you to push to origin again.
If git push origin master not working , all you need to do is edit that file with your favourite editor and change the URL = setting to your new location. Assuming the new repository is correctly set up and you have your URL right, you'll easily be able to push and pull to and from your new remote location.
This means that someone else pushed a commit to the same branch you're pushing to, but you don't have that commit on your laptop yet. This can happen if it has been awhile since you ran "git pull" on a branch that many people contribute to, such as staging. To fix this issue, run: git pull origin <your-branch>
Running git gc
resolved this for me. This will do some garbage-collecting housekeeping tasks which could be causing this issue.
I had this exact error with a very large (22Gb) mirror cloned repo that I was asked to import into our GitHub enterprise server.
git gc
helped as it reduced the size of the repo to a mere 7Gb but I still could not push it because there were ~13k tags (and apparently every one was vital!) which were listed as errors in the same way as the OP reports.
The solution is to push the tags in smaller blocks e.g.
git push refs/tags/tag-2015* git@my_server:my_org/my_repo
You can put this into a loop and push all the tags in blocks e.g.
for n in {15..20}; do git push refs/tags/tag-20${n}* git@my_server:my_org/my_repo; done
Now when you do the original push --mirror
those tags will already be present on the remote and you will not get the error.
Before getting to that I also pushed the branches in a similar way but as that didn't solve the issue I don't think it mattered. However incase it was relevant this is how you switch to each branch in a bare repo and push it.
git branch -a --format "%(refname)" | xargs -i bash -c "git symbolic-ref HEAD {} && git push git@my_server:my_org/my_repo"
This may be a myth but the reason I was given for this error is that git has some hidden limits deep within it. In this case there is a restriction on pushing tags where the whole operation must complete within 5 minutes. Hence breaking up the process works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With