git-修改遠程的URL


git remote set-url命令修改remote URL

git remote set-url傳遞兩個參數

  • remote name。例如,origin或者upstream
  • new remote url。例如,git@github.com:USERNAME/OTHERREPOSITORY.git

 

例如:從SSH切換到HTTPS的遠程URL

  1. 打開終端
  2. 切換到你項目的工作目錄
  3. 列出remotes,是為了得到你想要改變的remote的名字
    xxxxxx@xxxxxx:~/workspace/goal$ git remote -v
    origin    git@github.com:xxxxxx/SpringBoot.git (fetch)
    origin    git@github.com:xxxxxx/SpringBoot.git (push)
  4. 使用git remote set-url命令從SSH到HTTPS的遠程URL
    xxxxxx@xxxxxx:~/workspace/goal$ git remote set-url origin https://github.com/xxxxxx/SpringBoot.git
  5. 驗證是否改變成功
    xxxxxx@xxxxxx:~/workspace/goal$ git remote -v
    origin    https://github.com:xxxxxx/SpringBoot.git (fetch)
    origin    https://github.com:xxxxxx/SpringBoot.git (push)




免責聲明!

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



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