使用 git remote -v
列出現在目錄的所有遠端repository以及url設定
github [email protected]:veritymissed/RESTful-API-server.git (fetch)
github [email protected]:veritymissed/RESTful-API-server.git (push)
wavenet ssh://[email protected]:10022/veritymissed/Cytac.git (fetch)
wavenet ssh://[email protected]:10022/veritymissed/Cytac.git (push)
git remote add REMOTE_NAME new_url
在本機新增一個遠端repository名為 REMOTE_NAME,url為 new_url
git remote add bitbucket [email protected]:veritymissed/Cytac.git
然後用 git remote -v
查看
...
bitbucket [email protected]:veritymissed/Cytac.git (fetch)
bitbucket [email protected]:veritymissed/Cytac.git (push)
github [email protected]:veritymissed/RESTful-API-server.git (fetch)
...
git remote set-url REMOTE_NAME new_url
將 REMOTE_NAME 這個遠端repository的url改為 new_url
執行 git remote set-url github [email protected]:veritymissed/Cytac.git
然後用 git remote -v
查看
...
github [email protected]:veritymissed/Cytac.git (fetch)
github [email protected]:veritymissed/Cytac.git (push) //已更新為Cytac.git
wavenet ssh://[email protected]:10022/veritymissed/Cytac.git (fetch)
...
git remote rename OLD_REMOTE_NAME NEW_REMOTE_NAME
將 OLD_REMOTE_NAME 這個遠端repository的名稱改為 NEW_REMOTE_NAME
執行 git remote rename bitbucket bitfuckit
然後用 git remote -v 查看
bitfuckit [email protected]:veritymissed/Cytac.git (fetch)//改成bitfuckit了
bitfuckit [email protected]:veritymissed/Cytac.git (push)
github [email protected]:veritymissed/Cytac.git (fetch)
github [email protected]:veritymissed/Cytac.git (push)
wavenet ssh://[email protected]:10022/veritymissed/Cytac.git (fetch)
wavenet ssh://[email protected]:10022/veritymissed/Cytac.git (push)