Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Fix for Remote rejected shallow update not allowed after changing Git remote URL

Some Time there is a shallow update not allowed issue in your cloned GIT repo.

This means that you have to unshallow your repository. To do so you will need to add your old remote again.

git remote add origin <path-to-old-remote> After that we use git fetch to fetch the remaining history from the old remote (as suggested in this answer).

git fetch --unshallow origin And now you should be able to push into your new remote repository.

@reinaldorauch

This comment has been minimized.

Copy link

@reinaldorauch reinaldorauch commented Feb 27, 2020

Many thanks my friend, helped a lot o/

@seta-hungDang

This comment has been minimized.

Copy link

@seta-hungDang seta-hungDang commented Apr 14, 2020

Wow I get the same issue today. Thank you so much!

@ArLabDev

This comment has been minimized.

Copy link

@ArLabDev ArLabDev commented Jun 18, 2020

Hello, I'm trying to push my local repo to my newly created github repo and I get this error.
But the git fetch --unshallow origin command fails with
fatal: couldn't find remote ref refs/head/master

Am I missing something?

@jrasor

This comment has been minimized.

Copy link

@jrasor jrasor commented Jul 9, 2020

Same problem as ArtLabDev.

@codetot

This comment has been minimized.

Copy link

@codetot codetot commented Sep 11, 2020

If you see fatal: couldn't find remote ref refs/head/master, you must run git push origin HEAD:master first.

@asanodaria

This comment has been minimized.

Copy link

@asanodaria asanodaria commented Nov 28, 2020

Thanks Dear @gobinathm. git fetch --unshallow origin worked for me...

@NoSpamDan

This comment has been minimized.

Copy link

@NoSpamDan NoSpamDan commented Jan 31, 2021

Worked here too, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment