执行git add .命令后出现如下错误:
Another git process semms to be running in this repository, e.g. an editor opened by ‘git commit’. <br> Please make sure all processes are terminated then try again. If it still fails, a git process remove the file > manually to continue…
意思就是程序被占用。出现如下错误是因为我之前执行了git add .,但是中途停止了,然后git上的部分资源被锁上了。打开根目录里查看选项,勾选“隐藏的项目”选项,可以看到出现了.git文件夹,删掉其中的index.lock文件,然后再执行git add . 就行了。
执行git push 的时候,出现了如下错误:
Updates were rejected because the remote contains work that you do<br> hint: not have locally. This is usually caused by another repository pushing<br> hint: to the same ref. You may want to first integrate the remote changes<br> hint: (e.g., 'git pull ...') before pushing again.<br>
意思就是我创建仓库的时候,仓库里有我本地没有的文件,要先把它们组合在一起。原来是我在github上面创建仓库的时候,顺手创建了一个 README.md 文件。在网上查过之后,执行要先git pull --rebase 。按我的理解就是就是把当地做的修改直接加到master的后面,像是在最新的master之后进行的操作,然后和仓库里的文件整合在一起。最后再执行指令git push origin master就ok了。