git常见错误



网友经验:
1.fatal: remote origin already exists.

删除远程 Git 仓库 $ git remote rm origin
重新添加远程 Git 仓库 $ git remote add origin git@github.com:Your/Resp.git
如果 git remote rm origin 报错,可以手动修改gitconfig文件的内容$ vi .git/config
  [remote “origin”] 那一行删掉

2.Pull is not possible because you have unmerged files.
  方法一:.pull会使用git merge导致冲突,需要将冲突的文件resolve掉 git add -u, git commit之后才能成功pull.
方法二:.如果想放弃本地的文件修改,可以使用 git reset --hard FETCH_HEAD,FETCH_HEAD表示上一次成功git pull之后形成的commit点。然后 git pull.
注意:
git merge会形成MERGE-HEAD(FETCH-HEAD) 。git push会形成HEAD这样的引用。HEAD代表本地最近成功push后形成的引用。
”就我的经验,有时候会莫名其妙地出现这种状况,而且Untracked files 还特别多(实际上自己可能只改了一两个文件),所以只好先保存好自己确定做出的local的修改,然后用git reset --hard FETCH_HEAD回到上次成功pull之后的点,然后再pull就没有问题了“
3.You are not currently on a branch.
You are not currently on a branch, so I cannot use any
'branch..merge' in your configuration file.
Please specify which remote branch you want to use on the command
line and try again (e.g. 'git pull ').
See git-pull(1) for details.

首先git checkout -b temp
其次git checkout master
即可恢复到master repository的状态,然后就可以pull了



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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值