Import into github from gitorious?
Asked Answered
G

4

11

Has anyone tried or figured out how to import a gitorious repo into github? I already use github and wanted to see if there was a way to pull from a gitorious repo that I wanted to follow into github.

Gudren answered 1/7, 2009 at 2:20 Comment(0)
Y
25

How would this be different from the normal method of creating a repository on Github?

  1. Clone the repository from gitorious
  2. Create a new repository on github
  3. Push the repository up to github

Github doesn't care where the repository came from in the first place, it just accepts whatever you push up to it.

Yolandoyolane answered 1/7, 2009 at 2:40 Comment(1)
I was originally thinking of going from gitorious straight to github but I guess pulling it in locally then pushing is fine.Gudren
G
7

Immediately after you create a new repository on GitHub, the website gives you 3 elegant personalized instruction sets. The 3 different options are:

  1. Start working on a fresh new project
  2. Push an existing Git repository - this is the one you want
  3. Push an existing SVN repository

If my username was user1 and the new repo was called project1, here is what it would say:

Existing Git Repo?

cd existing_git_repo
git remote add origin [email protected]:user1/project1.git
git push -u origin master
Goglet answered 16/3, 2011 at 0:46 Comment(0)
A
6

The answers already given will just import master - if you want to import the entire repo including all branches, tags, etc, you need to do the following:

  • Create a blank github repo
  • Clone the gitorious repo using the --bare flag - this preserves all branches/tags and doesn't create a working copy:

    $ git clone --bare git://gitorious.org/USER/REPO.git
    
  • Change directory into the local repo:

    $ cd therepo.git
    
  • Push the repo to github using the --mirror flag - this copies all branches, tags, history etc.:

    $ git push --mirror [email protected]:USER/REPO.git
    
  • Remove the local copy - you don't need it anymore and it's not much use for anything

    $ cd .. && rm -rf therepo.git
    

Once you've done that, you can switch any local repos using the git remote rm/add commands as given above.

Anywhere answered 13/2, 2013 at 16:29 Comment(0)
M
2

The previous answers are correct, but here's the step by step process including the missing step of delinking the local copy from Gitorious; without it, you'll get the error fatal: remote origin already exists when you try to add Github as the new origin.

  1. Create empty target repo on Github
  2. Clone repo from Gitorious to local
  3. Remove Gitorious as origin
  4. Add Github as new origin
  5. Push to Github

Commands:

git clone git://gitorious.org/USER/REPO.git
cd REPO
git remote rm origin
git remote add origin https://github.com/USER/REPO.git
git push --mirror https://github.com/USER/REPO.git

You'll obviously need to substitute USER and REPO, and the last two commands are provided for you after step 1 when you create your Github repo.

Magistracy answered 9/8, 2012 at 7:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.