Unable to push to repository

Hi,

As of a few hours ago, we are not able to push to our remote repository.

We now have two branches which if we try to push to with no local changes, we get the error:

Enumerating objects: 12, done.
Counting objects: 100% (12/12), done.
Delta compression using up to 24 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (7/7), 1.19 KiB | 1.19 MiB/s, done.
Total 7 (delta 5), reused 7 (delta 5), pack-reused 0
remote: Resolving deltas: 100% (5/5), completed with 5 local objects.
To github.com:<my organisation>/<my private repository>.git
 ! [remote rejected]       master -> master (cannot lock ref 'refs/heads/master': is at XXXX.... but expected YYYY....
error: failed to push some refs to 'github.com:<my organisation>/<my private repository>.git'

Where XXXX is the last commit and YYYY is an earlier commit from yesterday.

Making a source code change directly on Github and running git pull works and gets the change, but doing a git push after that results in the same error.

If we attempt to create a new branch off another old branch, with no changes and just push to remote with git push -u origin test-branch, and then immediately run just git push, we get the following error:

Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
To github.com:<my organisation>/<my private repository>.git
 ! [remote rejected]       test-branch -> test-branch (cannot lock ref 'refs/heads/test-branch': reference already exists)

Cloning to a new local repository does not help, so we suspect remote references got corrupt somehow.

This is rather urgent and your help would be greatly appreciated.

Kind regards,
Marko

3 Likes

I’m experiencing the same, and at least another person has told the same in Twitter. I’ve reported it to GitHub support.

I had it last Friday, now seems to be corrected (without any intervention by me).

Thanks GitHub I suppose ?

:ok_hand:

Is there something to do to prevent/fix this issue other than writing to github support?

Hey,

You may try cleaning up your local repository with:

git gc --prune=now
git remote prune origin

Hi! I have the same problem with PUSH.

git gc --prune=now
git remote prune origin

These doesn’t work.
When I push, git throw this:

To https://github.com/gabrielbasetti/XXXXXXX.git
 ! [remote rejected] master -> master (cannot lock ref 'refs/heads/master': is at a33207cbdb2ce9834c14d68b5381f373a1XXXXXX but expected 429f96308d492ddf2db0a9550455b84fe5XXXXXX)
error: failed to push some refs to 'https://github.com/gabrielbasetti/XXXXXXX.git'
1 Like