git 作為如今廣泛應用的專案版本管理系統,在初次接觸的時候會遇到一些問題,本系列就是對其中一些常見問題的小結。
在push
本地倉庫檔案時,有時會上傳一些不需要上傳到git的檔案,這個時候可以採用將這些不需要上傳的檔案新增到 .gitignore 檔案中,即可在每次上傳時忽略。
具體操作為通過命令$ vim .gitignore
開啟 .gitignore 檔案,編輯新增需要忽略的檔名或目錄。vim
操作參考:mac os基本命令(一):檔案相關操作。
如果一不小心把不需要的檔案上傳了,這個時候可以考慮直接刪除該檔案。
首先在本地先刪除該檔案:
# 預覽要刪除的檔案
$ git rm -r -n -
-cached filename
#刪除檔案
$ git rm -r -
-cached filename
再將結果推送到遠端倉庫:
$ git commit -m '修改說明'
$ git push origin branch_name
之後記得將不需要上傳的檔案新增到 .gitignore 檔案中。 git基礎管理 操作遠端倉庫
檢視遠端倉庫的名字git remote 複製 檢視詳細的倉庫名對應的 urlgit remote v 複製 git remote add t2web git gitlab.d3j.io chanjet t2web.git 複製 git fecth remote name 抓取到了遠端倉庫的最新資訊,...
git遠端倉庫(二)
ssh keygen t rsa c 573143765 qq.com 然後一路回車 root localhost ll ssh 總用量 8 rw 1 root root 1675 3月 18 04 28 id rsa 私有,自己保留 rw r r 1 root root 398 3月 18 04 ...
Git遠端倉庫 二
昨天講了git安裝使用和基本的命令,今天我說一下如何通過git將本地管理的倉庫新增到遠端庫 首先我們需要在www.github.com 如果打不開網頁,請注意科學上網 上註冊乙個免費的賬號,郵箱驗證完成後就可以登陸了,找到new repository,點進去後給你的倉庫起個名字,然後點create ...