
1.git init 初始化

2.git remote origin add https://gitee.com/su_yong_qing/SyqSystem.git 這里注意把鏈接替換為自己的倉庫鏈接

3.git status 查看檔案資訊

4.git add . 將所有檔案托管暫存

5.git commit -m'tips-01' 添加注釋資訊

6.git push origin master

7.如果我們是下載別人的檔案的話,執行這行代碼就可以啦
git pull origin master
常見問題
01.配置資訊
這里注意 如果我們是第一次上傳的話,需要配置一下賬號資訊

$ git config --global user.name "user.name"
(說明:雙引號中需要你的用戶名,這個可以隨便輸入,比如“zhangsan”)
$ git config --global user.email "[email protected]"
02.系統出現如下錯誤:warning: LF will be replaced by CRLF
原因分析:
CRLF -- Carriage-Return Line-Feed 回車換行
就是回車(CR, ASCII 13, \r) 換行(LF, ASCII 10, \n),
這兩個ACSII字符不會在螢屏有任何輸出,但在Windows中廣泛使用來標識一行的結束,而在Linux/UNIX系統中只有換行符,
也就是說在windows中的換行符為 CRLF, 而在linux下的換行符為:LF
使用git來生成一個rails工程后,檔案中的換行符為LF, 當執行git add .時,系統提示:LF 將被轉換成 CRLF
解決方法:
洗掉剛剛生成的.git檔案
$ rm -rf .git
$ git config --gobal core.autocrlf false
03.fatal: Unable to create '/xxx/xx/.git/index.lock': File exists.
在git沒有運行完成之前強制關閉,下次提交的時候會產以下生錯誤,或者類似的,
錯誤提示:
fatal: Unable to create '/xxx/xx/.git/index.lock': 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.
解決方法:
原因是在你進行某些比較費時的git操作時自動生成,操作結束后自動洗掉,相當于一個鎖定檔案,目的在于防止對一個目錄同時進行多個操作,
有時強制關閉進行中的git操作,這個檔案沒有被自動洗掉,之后你就無法進行其他操作,必須手動洗掉,進入.git檔案中洗掉,打開顯示隱藏檔案,如果沒有看見.git檔案夾,可以直接用命令rm -f ./.git/index.lock,之后就可以正常使用,

目前博主遇到的幾個常見問題就這些,如果沒能解決的話,歡迎在下方評論留言哦!
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/109076.html
標籤:其他
