26

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 'git@github.ZZZZ.com:XXXX/YYYY.git'
>     Branch master set up to track remote branch master from origin.
Bertrand
  • 777
  • 6
  • 17

5 Answers5

40

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

Paul
  • 4,260
  • 1
  • 27
  • 35
1

It appears that i had to many references (~9000). Removing most of them fixed the issue

Bertrand
  • 777
  • 6
  • 17
1

I did a git pull --rebase branchname and then git push origin branchname

Sajicode
  • 336
  • 3
  • 10
1

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.

Martin
  • 1,468
  • 19
  • 27
0

It looks like this error will also happen when Github is down (you can check Github's status here), as it is currently at the time I'm writing this. I'm getting a similar error, preceded by Internal Server Error:

davidcalhoun@Davids-MacBook-Pro hugo % git push
Enumerating objects: 11, done.
Counting objects: 100% (11/11), done.
Delta compression using up to 16 threads
Compressing objects: 100% (5/5), done.
Writing objects: 100% (6/6), 485 bytes | 485.00 KiB/s, done.
Total 6 (delta 4), reused 2 (delta 0)
remote: Resolving deltas: 100% (4/4), completed with 4 local objects.
remote: Internal Server Error
To github.com:davidcalhoun/davidbcalhoun.com.git
 ! [remote failure]    master -> master (remote failed to report status)
error: failed to push some refs to 'git@github.com:davidcalhoun/davidbcalhoun.com.git'
David Calhoun
  • 6,835
  • 3
  • 25
  • 22
  • 1
    Can confirm. Just panicked and removed the directories off of my machine to try and figure this out before I thought to check the status. – Ian Feb 27 '20 at 15:54