git常见问题

这些是在使用git中遇到的问题,和解决这些问题的方法:

1) you need to resolve your current index first

分析:这是在分支切换的时候,执行  git pull (fetch+merge = pull),由于长时间没有和remote分支merge,分支间的冲突,解决这个冲突就好了。
解答:

2) Updates were rejected because the tip of your current branch is behind

分析:hint: Updates were rejected because a pushed branch tip is behind its remote 远程仓库的分支比本地的代码要新所以远程的repository和本地的repository冲突。没有pull…
解答:

// 1.首先先pull到本地(避免下面一步覆盖远程)
  git pull origin develop
// 2. 强制push到远程(谨慎覆盖远程)
 git push -u origin develop -f

3)git push时出现的问题

 

解: 情况:在本地用clone了一份代码~ 这个项目是第一次提交~ 直接用的git push(没有指定分支)
看git给的提示 git config –global push.default matching
push.default包含nothing(不push任何分支), matching (本地分支和服务器匹配), upstream(当前分支push到upstream分支), simple(当前分支push到upstream分支上,名字不匹配拒绝,git2.0+默认 安全), current(将当前分支push到同名分支)这五个值
4.error: You have not concluded your merge

解:保留本地 git merge –abort

5.添加.gitignore不起作用

解决办法:删除cache(***为项目名字)


6.fatal: pathspec ‘file‘ did not match any files

解决办法:

  • 首页找到file这个文件,是不是没有引用
  • 上不没解决试试 git rm -rf –cached file

7. Untracked files:

Untracked files:
(use “git add <file>…” to include in what will be committed)

SSIns/Assets.xcassets/SSUser/


8. git clone https://github.com/****.git
Cloning into ‘MonkeyDev’…
fatal: unable to access ‘https://github.com/AloneMonkey/MonkeyDev.git/’: Failed to connect to 127.0.0.1 port 1086: Connection refused

继续更新中..

发表回复

电子邮件地址不会被公开。 必填项已用*标注

Protected with IP Blacklist CloudIP Blacklist Cloud