天天看點

如何從bitbucket到github的所有分支移動git存儲庫?

本文翻譯自:How to move git repository with all branches from bitbucket to github?

What is the best way to move a git repository with all branches and full history from bitbucket to github?

将所有分支和完整曆史從bitbucket移動到github的git存儲庫的最佳方法是什麼?

Is there a script or a list of commands I have to use?

是否有腳本或指令清單我必須使用?

#1樓

參考:https://stackoom.com/question/1Y78P/如何從bitbucket到github的所有分支移動git存儲庫

#2樓

You can refer to the GitHub page " Duplicating a repository "

您可以參考GitHub頁面“ 複制存儲庫 ”

It uses:

它用:
  • git clone --mirror

    : to clone every references (commits, tags, branches)

    git clone --mirror

    :克隆每個引用(送出,标記,分支)
  • git push --mirror

    : to push everything

    git push --mirror

    :推送一切

That would give:

這會給:
git clone --mirror https://bitbucket.org/exampleuser/repository-to-mirror.git
# Make a bare mirrored clone of the repository

cd repository-to-mirror.git
git remote set-url --push origin https://github.com/exampleuser/mirrored
# Set the push location to your mirror

git push --mirror
           

As Noted in the comment s by LS :

正如LS 的評論中所述 :
  • it is easier to use the

    Import Code

    feature from GitHub described by MarMass . 使用MarMass描述的GitHub中的

    Import Code

    功能更容易。
    See https://github.com/new/import 請參閱https://github.com/new/import
  • Unless ... your repo includes a large file: the problem is, the import tool will fail without a clear error message. 除非 ...你的repo包含一個大檔案:問題是,導入工具将失敗而沒有明确的錯誤消息。 Only GitHub Support would be able to diagnose what happened. 隻有GitHub支援才能診斷發生了什麼。

#3樓

http://www.blackdogfoundry.com/blog/moving-repository-from-bitbucket-to-github/

http://www.blackdogfoundry.com/blog/moving-repository-from-bitbucket-to-github/

This helped me move from one git provider to another.

這幫助我從一個git提供者轉移到另一個。

At the end of it, all the commits were in the destination git.

最後,所有送出都在目标git中。

Simple and straight forward.

簡單直接。
Once I was happy that the push had been successful to GitHub, I could delete the old remote by issuing: 一旦我對GitHub的推送成功感到高興,我可以通過發出以下指令删除舊的遙控器:

#4樓

It's very simple.

這很簡單。

1º Create a new empty repository in GitHub (without readme or licesne, you can add them before) and the following screen will show

1º在GitHub中建立一個新的空存儲庫(沒有自述檔案或licesne,您可以在之前添加它們),以下螢幕将顯示

2º Inside to import code option you paste your bitbucket URL's repo and voilà!!

2º在裡面導入代碼選項你粘貼你的bitbucket URL的repo和voilà!!
如何從bitbucket到github的所有分支移動git存儲庫?

#5樓

In case you couldn't find "Import code" button on github, you can:

如果您在github上找不到“導入代碼”按鈕,您可以:
  1. directly open Github Importer and enter the

    url

    . 直接打開Github Importer并輸入

    url

    It will look like: 它看起來像:
    如何從bitbucket到github的所有分支移動git存儲庫?
  2. give it a name (or it will import the name automatically) 給它一個名字(或者它會自動導入名字)
  3. select

    Public

    or

    Private

    repo 選擇

    Public

    Private

    倉庫
  4. Click

    Begin Import

    單擊

    Begin Import

UPDATE: Recently, Github announced the ability to " Import repositories with large files "

更新:最近,Github宣布了“ 導入大檔案存儲庫 ”的能力

#6樓

I had the reverse use case of importing an existing repository from github to bitbucket.

我有一個将現有存儲庫從github導入bitbucket的反向用例。

Bitbucket offers an Import tool as well.

Bitbucket也提供導入工具 。

The only necessary step is to add URL to repository.

唯一必要的步驟是将URL添加到存儲庫。

It looks like:

看起來像:
如何從bitbucket到github的所有分支移動git存儲庫?