how to move git respository between hosting providers
Asked Answered
L

3

12

I currently use Assembla for my git hosting. I want to move my git repository to github hosting. I have never done this before - what is the process? Obviously, I want to keep all my previous commits/changes, etc...

Thanks.

Locative answered 12/7, 2011 at 23:4 Comment(1)
Have a look at this Importing an external Git repository help page on Github.Emlynne
L
11

Pull your repository to a local location using git clone.

Then create a new repository on github.com, remove the old remote and add the new remote:

git remote rm "assembla remote name"
git remote add origin [email protected]/your_repo_path
git push -u master
Lal answered 12/7, 2011 at 23:7 Comment(2)
Do you need to do a separate push of tags with git push --tags?Mate
From github: By default, push will only send the ref you specify. To push a single tag you can simply use git push REMOTENAME TAGNAME. To push all tags while pushing another branch, you can use git push REMOTENAME BRANCHNAME --tags.Lal
B
8

First, create a new (empty) repository in GitHub - say Test

Next, Clone from Assembla ( if not already, or git pull )

Finally, do the following:

  cd cloned_from_assembla
  git remote rm origin
  git remote add origin [email protected]:user/Test.git
  git push -u origin master

(basically, remove the remote pointing to assembla and create new one to github and push to it. These instructions are same as the one provided to you by GitHub once you create a new repo.)

Boarding answered 12/7, 2011 at 23:9 Comment(0)
D
1

You simply need to add new remote to your existing repository and then you can work on multiple remotes.

How to add new remote?

git remote add <new_name><new url>

and from this point on you can simply do anything on this repo (assuming you have permissions)

git pull <new_name> <branch>
git push <new_name> <branch>

enter image description here

Downward answered 10/1, 2016 at 7:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.