git push时报remote rejected shallow update not allowed 的问题
2024-08-03
64
今天在git push 代码的时候遇到一个问题:
Counting objects: 47, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (21/56), done.
Writing objects: 100% (17/58), 596.15 KiB | 0 bytes/s, done.
Total 56 (delta 11), reused 0 (delta 0)
remote: Resolving deltas: 100% (11/11), done.
To github.com:xxx/xxxx.git
! [remote rejected] master - master (shallow update not allowed)
error: failed to push some refs to git@github.com:xxx/xxxx.git
在stackoverflow 上找到的答案:
https://stackoverflow.com/questions/28983842/remote-rejected-shallow-update-not-allowed-after-changing-git-remote-url
根据提示,初步分析原因,提示的问题应该是浅拷贝,就是我们在git clone的时候,depth设置的太浅,没有全部的历史记录。
所以解决办法,应该是从原来的地址,把整个git库都clone一下即可。
问题的原因也就很清楚了,我在 clone 原仓库时用了 git clone --depth 1,导致本地为 shallow repo。
解决方法也很简单:
git fetch --unshallow origin
origin 就是原仓库,fetch 完后就能正常push 了。
更新于:3个月前赞一波!1
相关文章
- MVC跨域问题 Response for preflight has invalid HTTP status code 405
- composer install、update、require 区别
- 修改数据 update 命令
- composer self-update 更新版本
- c++运行时报错误:there is a mismatch in alloc and dealloc
- Linux编译内核模块时报: linux/scripts/recordmcount: No such file or directory
- 编译Linux内核模块时报:WARNING: Symbol version dump "Module.symvers" is missing.
- QT编译时报错 error: lnk1158: cannot run 'rc.exe'
- linux中Qt编译时报错:qwt_dial.h: No such file or directory
- gcc或g++编译链接时报undefined reference to “xxx”
- 自建的nuget Server推送时报错:Response status code does not indicate success: 406 (Not Acceptable)
- linux中gcc/g++编译时报错 fatal error: codecvt: No such file or directory
- vscode通过Remote-SSH插件连接Linux时报Error: XHR failed错误
文章评论
评论问答