Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git error when pushing (remote failed to report status)

Tags:

git

github

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.
like image 645
Bertrand Avatar asked Feb 22 '19 13:02

Bertrand


People also ask

How do I fix git push failed?

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.

How do I fix error failed to push some refs in GitHub?

To fix this issue, run git pull on your local repository. This should allow you to push to origin again.

Why git push is not working?

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.

What does failed to push some refs mean?

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>


2 Answers

Running git gcresolved this for me. This will do some garbage-collecting housekeeping tasks which could be causing this issue.

like image 173
Paul Avatar answered Oct 22 '22 04:10

Paul


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.

like image 2
Martin Avatar answered Oct 22 '22 04:10

Martin