![](/img/trans.png)
[英]how to remove the old commits history from a specific subdirectory of a github repo?
[英]Can I some how migrate my repo with all commits history from BitBucket to GitHub?
是否可以將.git文件中的終結點從Bit Bucket更改為GitHub,並使用所有提交歷史記錄也對GitHub進行提交?
您只需要更改本地存儲庫的遠程目錄即可。 從本文開始 ,描述了如何從GitHub遷移到BitBucket:
更改原始網址
- 在命令行上轉到本地計算機上的存儲庫
- 輸入:git remote -v。 這應該表明回購源仍在github上。 例如
origin https://USERNAME@github.com/USERNAME/REPONAME.git (fetch) origin https://USERNAME@github.com/USERNAME/REPONAME.git (push)
- 編輯存儲庫的git config文件:sudo nano .git / config
- 更改URL(在遠程“來源”下)並將github.com更改為bitbucket.com。 如果您的用戶名在bitbucket上不同,則可能需要更改用戶名。 您還應該將其更改為git URL。 即git@bitbucket.org:USERNAME / REPONAME.git
您只需要切換GitHub和BitBucket。 確保在本地存儲庫中是最新的(例如git pull
before)。
GitHub存儲庫應為新創建的空存儲庫。 執行git push
將把所有帶有提交歷史的代碼移到新的倉庫中。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.