Git操作:遠程倉庫(git remote)的添加、管理和刪除


這是你的git倉庫,他已經添加了一個遠程倉庫,可以用git remote -v查看綁定的倉庫列表,他會以<倉庫名>  <倉庫地址>的形式展示出來(一個倉庫會顯示兩遍):

$ git remote -v
origin  https://xxx.com/lyj00912/xxx.git (fetch)
origin  https://xxx.com/lyj00912/xxx.git (push)

如果要刪除一個倉庫,可以用git remote remove <倉庫名>來刪除這個倉庫:

$ git remote remove origin

刪除之后再查看git remote -v,就會發現倉庫已經被刪除,列表為空:

$ git remote -v

如果要添加新的倉庫,使用git remote add <倉庫名> <倉庫地址>來添加:

$ git remote add newrepo https://xxx.com/lyj00912/xxx.git

添加之后再查看git remote -v,就會發現倉庫已經添加進去了:

$ git remote -v
newrepo   https://xxx.com/lyj00912/xxx.git (fetch)
newrepo   https://xxx.com/lyj00912/xxx.git (push)

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM