3 回答

TA貢獻1943條經驗 獲得超7個贊
要添加新的回購位置,
git remote add new_repo_name new_repo_url
然后將內容推送到新位置
git push new_repo_name master
最后刪除舊的
git remote rm origin
之后,您可以執行bdonlan所說的操作,然后編輯.git / config文件以將new_repo_name更改為origin。如果您不刪除原始資源(原始遠程存儲庫),則只需使用以下命令將更改推送到新存儲庫即可
git push new_repo_name master

TA貢獻1785條經驗 獲得超4個贊
如果要遷移所有分支和標記,則應使用以下命令:
git clone --mirror [oldUrl]
用所有分支克隆舊倉庫
cd the_repo
git remote add remoteName newRepoUrl
設置一個新的遙控器
git push -f --tags remoteName refs/heads/*:refs/heads/*
將所有裁判推到裁判/門下(這可能是您想要的)

TA貢獻1803條經驗 獲得超6個贊
這完美地為我工作。
git clone --mirror <URL to my OLD repo location>
cd <New directory where your OLD repo was cloned>
git remote set-url origin <URL to my NEW repo location>
git push -f origin
我必須提到,這會創建您當前回購的鏡像,然后將其推送到新位置。因此,對于大型存儲庫或緩慢的連接,這可能需要一些時間。
- 3 回答
- 0 關注
- 943 瀏覽
添加回答
舉報