0

Seeing this error on first git push of a patch to a freshly cloned github project:

 ! [remote rejected] master -> master (shallow update not allowed)
error: failed to push some refs to 'https://github.com/org/myproject.git'

How to fix it and what may be the cause?

This question is NOT related to Remote rejected (shallow update not allowed) after changing Git remote URL as someone suggested.

Roel Van de Paar
  • 1,439
  • 16
  • 28
  • https://stackoverflow.com/search?q=%5Bgit%5D+remote+rejected+shallow+update+not+allowed – phd Aug 27 '20 at 00:19
  • @phd sorry but that is unrelated! This is a different question, with a different reason, and a different answer to fix it (even though one of the commands used is the same). Please re-open this question. – Roel Van de Paar Aug 27 '20 at 03:15
  • 1
    If that is a different question, please clarify **how** this differs – Nico Haase Aug 27 '20 at 09:23
  • This error is on git push, and has nothing to do with a remote change, as far as I know. The cause is also different (i.e. not a remote change); it is caused by `--depth=1` on prior invocation. Please re-open this question. – Roel Van de Paar Aug 27 '20 at 22:03
  • Please undelete this question. – Roel Van de Paar Aug 30 '20 at 22:26

1 Answers1

0

One possible reason may be that your originally pulled the branch with

git clone --depth=1 ...link... 

If so, the fix is easy;

git fetch --unshallow origin
Roel Van de Paar
  • 1,439
  • 16
  • 28