問題一:git warning: LF will be replaced by CRLF in 解決辦法
在Git Bash中輸入git add .
時出現上述語句。
解決辦法:
輸入以下語句:
1 $ git config core.autocrlf false
,這樣設置git的配置后在執行add操作就沒有問題了。
問題二:On branch master nothing to commit, working tree clean
在Git Bash中輸入 git commit -m " "
時出現下列語句:
On branch master nothing to commit, working tree clean
On branch master nothing to commit, working tree clean
含義是:項目沒有被修改,不需要提交。也就是說:修改->add->修改->commit
只能commit
已經add
的修改。
若要保存第二次修改需要再一次add
然后commit
。
問題三:fatal: could not open '.git/COMMIT_EDITMSG': Permission denied
在Git Bash中輸入 git commit -m " "
時出現下列語句:
fatal: could not open '.git/COMMIT_EDITMSG': Permission denied
解決辦法:
輸入以下語句:
1 $ chmod 664 COMMIT_EDITMSG
問題四:fatal: the remote end hung up unexpectedly
在輸入git push origin master
之后出現fatal: the remote end hung up unexpectedly
,表示上傳文件太大,導致上傳失敗。
解決辦法:
參考博客:https://www.cnblogs.com/hanxianlong/p/3464224.html
問題五:fatal: refusing to merge unrelated histories
在輸入下拉語句 git pull origin master
之后出現fatal: refusing to merge unrelated histories
,這個問題是因為這是兩個不想干的Git庫,一個是本地庫,一個是遠端庫,然后本地與遠端不相干,所以告知無法合並。
解決辦法:
使用強制方法:
1 git pull origin master --allow-unrelated-histories
后面加上 --allow-unrelated-histories
,參數的意思是合並倉庫的時候,允許不相關的歷史的提交內容,后面再push就可以了 。