Git:Clone别人的代码之后push到自己码云上失败的解决办法

最近也是刚开始使用gitee,比较生疏。场景是这样的:

clone了朋友的一份代码到自己的本地,然后自己想把它保存到自己的gitee 私有仓库上,就在gitee上面创建了一个私有的仓库,然后多次push都失败了,实践了网上提供rebase的方案也无济于事,都会爆出下面的错误信息;

 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'git@gitee.com:fortunamajor/um.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.


然后经过分析,自认为认为Clone下来的项目文件下的 .git 文件有问题(说有问题其实也不是很对,可能对我这个环境来说有问题,本身是没有问题的),所以就果断删除了所Clone项目根目录下的 .git 文件,再次进行了下面的操作,完美解决问题

但是这个骚操作比较危险,很可能对于需要历史记录的人来说!这个方案也是不得已而出此猥琐下策!

参考:https://blog.csdn.net/simpledate/article/details/81907359

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值