git 常见问题总结(持续更新中)

关于Git无法提交 index.lock的解决办法

今天提交代码时,在一次提交,莫名其妙没成功后,再次用git commit -a命令时,出现以下错误,无论是用git还是TortoiseGit都会出现以下这个问题。。

$ git commit -a
fatal: Unable to create 'e:/git/Android/XXXXXX/.git/index.lock': File e
xists.

If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.

解决办法:找到index.lock 删除即可

更多参考

git Bush应用崩溃If no other git process is currently running

问题:

用git Bush提交的时候遇到一个问题,不论做什么操作都遇到下面的错误信息:

fatal: Unable to create 'XXXXXXXXX' : File exists.

If no other git process is currently running,

this probably means a git process crashed in this repository earlier.

Make sure no other git process is running and remove the file manually to continue.
解决方案:

1.按照’XXXXXXXXX’里面说的路径找到该文件,删除就可以了

2.如果没有以上的提示

则把仓库目录里的.git/index.lock文件(文件是隐藏的)删除就可以了。删除index.lock不会影响Git使用。是说index文件被锁住了,但是还有一个index文件要进行操作。

一个仓库配有一个.git文件夹,在这个文件夹里面生成了一个index.lock文件,导致index文件不能被操作,所以把index.lock删除就ok。

在选择的产库目录下找到.git
git 常见问题总结(持续更新中)_第1张图片

更多参考

git pull 提示 There is no tracking information for the current branch

在执行git pull的时候,提示当前branch没有跟踪信息:

git pull
There is no tracking information for the current branch.
Please specify which branch you want to merge with.

是因为本地分支和远程分支没有建立联系 (使用git branch -vv 可以查看本地分支和远程分支的关联关系) .

对于这种情况有两种解决办法,就比如说要操作master吧,一种是直接指定远程master:

git pull origin master

另外一种方法就是先指定本地master到远程的master,然后再去pull:

git branch --set-upstream-to=origin/master master
git pull

这样就不会再出现“There is no tracking information for the current branch”这样的提示了。

更多参考

git中Please enter a commit message to explain why this merge is necessary

问题:

git 在pull或者合并分支的时候有时会遇到这个界面

git 常见问题总结(持续更新中)_第2张图片

Please enter a commit message to explain why this merge is necessary.

请输入提交消息来解释为什么这种合并是必要的.

解决方法:

可以不管(直接下面3,4步),如果要输入解释的话就需要:

1.按键盘字母 i 进入insert模式

2.修改最上面那行黄色合并信息,可以不修改

3.按键盘左上角"Esc"

4.输入":wq",注意是冒号+wq,按回车键即可

更多参考

你可能感兴趣的:(git)