Move repo from bitbucket to github
The short way...
Edit the [remote "origin"] branch url, create github repo, and push:
# this
[remote "origin"]
url = ssh://git@bitbucket.org/jbowles/learning-nodejs.git
fetch = +refs/heads/*:refs/remotes/origin/*
#to this
[remote "origin"]
url = git@github.com:jbowles/learning-nodejs.git
fetch = +refs/heads/*:refs/remotes/origin/*
$git push -u origin master
The long way
Open .git/config and delete [remote "origin"] branch:
$vim .git/config
So that this:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
[remote "origin"]
url = ssh://git\@bitbucket.org/jbowles/learning-nodejs.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
rebase = true
looks like this
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
[branch "master"]
remote = origin
merge = refs/heads/master
rebase = true
Create repo in Github and when it comes to time to add the remote origin do:
$git remote add origin git@github.com:jbowles/learning-nodejs.git
and your .git/config should look like this:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
[branch "master"]
remote = origin
merge = refs/heads/master
rebase = true
[remote "origin"]
url = git@github.com:jbowles/learning-nodejs.git
fetch = +refs/heads/*:refs/remotes/origin/*
Then push:
$git push -u origin master
Written by josh bowles
Related protips
2 Responses
Or with even less hassle:
git remote rm origin
git remote add origin git@github.com:username/project.git
git push -u origin
over 1 year ago
·
This won't transfer wiki's/issues/comments etc... just the repo and history
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Open source
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#