What is the best way to move a git repository with all branches and full history from bitbucket to github? Is there a script or a list of commands I have to use?
相关问题
- How to add working directory to deployment in GitH
- Upload file > 25 MB on Github
- Can I input Git command in Android Studio IDE?
- Source tree not able to push
- Git lost local commited files after git checkout
相关文章
- java开发bug问题:GitHub授权登录无法获取授权账号信息?
- Is there a Github markdown language identifier for
- Access BitBucket payload data in Jenkins pipeline
- “no implicit conversion of Integer into String” er
- GitHub:Enterprise post-receive hook
- git commit directory
- travis-ci setup releases with --github-token
- git commit gives error: empty commit set passed
I realize this is an old question. I found it several months ago when I was trying to do the same thing, and was underwhelmed by the answers given. They all seemed to deal with importing from Bitbucket to GitHub one repository at a time, either via commands issued à la carte, or via the GitHub importer.
I grabulated the code from a GitHub project called gitter and modified it to suite my needs.
You can fork the gist, or take the code from here:
Then, to use the script:
Simplest way of doing it
git remote rename origin repo_bitbucket
git remote add origin https://github.com/abc/repo.git
git push origin master
Once the push to GitHub is success ,delete the old remote by
git remote rm repo_bitbucket
You can refer to the GitHub page "Duplicating a repository"
It uses:
git clone --mirror
: to clone every references (commits, tags, branches)git push --mirror
: to push everythingThat would give:
As Noted in the comments by L S:
Import Code
feature from GitHub described by MarMass.See https://github.com/new/import
There is the Importing a repository with GitHub Importer
If you have a project hosted on another version control system as Mercurial, you can automatically import it to GitHub using the GitHub Importer tool.
You'll receive an email when the repository has been completely imported.
In case you couldn't find "Import code" button on github, you can:
url
. It will look like:Public
orPrivate
repoBegin Import
UPDATE: Recently, Github announced the ability to "Import repositories with large files"
In case you want to move your local git repository to another upstream you can also do this:
to get the current remote url:
will show something like: https://bitbucket.com/git/myrepo
to set new remote repository:
now push contents of current (develop) branch:
You now have a full copy of the branch in the new remote.
optionally return to original git-remote for this local folder:
Gives the benefit you can now get your new git-repository from github in another folder so that you have two local folders both pointing to the different remotes, the previous (bitbucket) and the new one both available.