gitlab常用功能

git解決 fatal: unable to connect to github.com
原因:
需要用https才能讀到數據
解決方法:輸入命令
git config --global url."https://".insteadOf git://


git命令執行git clone提示“fatal: unable to access目標地址”的問題
當執行git clone https://github.com/burnszp/guns-lite.git 命令的時候,一直提示無法訪問
解決方法:把https改成git即可


git SSL certificate problem: unable to get local issuer certificate
解決方法:
git config --global http.sslVerify false


解決 fatal: Not a git repository (or any of the parent directories): .git 問題
解決方法:
git init


gitlab切換分支
1) 把項目下載到本地 git clone https://(改成完整url)
2) 切換到文件目錄下,git branch -a,查看是否存在分支
3) 切換到你想要到的分支
git checkout 分支名
4) 檢查是否切換成功,查看當前分支
git branch


切換到D盤
cd d:
進入目錄
cd ./saturn/saturn
切換分支
git checkout luochengang


把本地項目上傳至gitlab
git pull origin luochengang --allow-unrelated-histories
git commit -am "description"
-a 表示 add
commit前需要git add
git push -u origin luochengang         //第一次push加上-u參數,以後就可以直接使用git push origin luochengang
提交代碼流程:
首先pull,然後add,然後commit,最後push


git報錯:'fatal:remote origin already exists'
1) 先刪除
git remote rm origin


.gitkeep的作用是爲了提交空文件夾

撤銷“修改並git commit,並且發送到了gitlab”的文件
1) git log查看提交歷史記錄
我們通過git log可以看到上一次提交的id爲e1aa8a5771abee379236b0825e2140c0955bec35,我們使用git revert命令撤銷提交(也可以用HEAD代替本次ID)
2) git revert HEAD
3) git log查看提交歷史記錄


git add總結:
git add -A 提交所有變化
git add -u 提交被修改(modified)和被刪除(deleted)文件,不包括新文件(new)
git add . 提交新文件(new)和被修改(modified)文件,不包括被刪除(deleted)文件


常用模板:
1) git pull origin luochengang --allow-unrelated-histories
2) git add -A (可以按照需要改成相應的add指令)
3) git commit -m "description"
4) git push origin luochengang

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章