shallow update not allowed

! [remote rejected] master -> master (shallow update not allowed)

https://stackoverflow.com/questions/28983842/remote-rejected-shallow-update-not-allowed-after-changing-git-remote-url

As it seems you have used git clone --depth <number> to clone your local version. This results in a shallow clone. One limitation of such a clone is that you can't push from it into a new repository.

You now have two options:

  1. if you don't care about you're current or missing history, take a look at this question
  2. if you want to keep your full history, then continue reading:

So, you want to keep your history, eh? This means that you have to unshallow your repository. To do so you will need to add your old remote again.

git remote add old <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 old

And now you should be able to push into your new remote repository.


Note: After unshallowing your clone you can obviously remove the old remote again.

 

个人分析:

比如从网址1(github) clone一个repository,但是repository很大。过了一段时间,可能git后台回收了一部分objects,太久不用的。

那么等你想要更换网址2(osc)的时候,比如push到osc的时候。

这个时候push,可能就会少一些文件。

那么需要git fetch --unshallow github

然后再git push osc

 

转载于:https://www.cnblogs.com/chucklu/p/10883861.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值