First, I created a .gitignore file to filter out anything unwanted. On a Mac, for example, it is alway a good idea to add:
Then to create the initial repository and commit locally
$ cd vendor/plugin/rur
$ git init
Initialized empty Git repository in .git/
$ git add .
$ git commit
Now the big push:
$ git push firstname.lastname@example.org:rur/mainline.git
The authenticity of host 'gitorious.org (188.8.131.52)' can't be established.
RSA key fingerprint is 1d:0f:80:3b:95:c5:a8:08:85:f6:fc:0a:b2:54:52:bb.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'gitorious.org,184.108.40.206' (RSA) to the list of known hosts.
No refs in common and none specified; doing nothing.
fatal: The remote end hung up unexpectedly
Whoops! Not quite what I expected. Let’s try to pull first then?
$ git clone email@example.com:rur/mainline.git
Initialized empty Git repository in /Users/psq/tmp/mainline/.git/
fatal: no matching remote head
fetch-pack from 'firstname.lastname@example.org:rur/mainline.git' failed.
Hmm, not quite either.
Looking at the gitorious “faq”http://gitorious.org/about/faq provides the answer :) Add the remote and master definitions to .git/config:
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
url = email@example.com:rur/mainline.git
fetch = +refs/heads/*:refs/remotes/origin/*
remote = origin
merge = refs/heads/master
(Change to match your project).
Then, try to push again:
$ git push origin master
Done counting 22 objects.
Deltifying 22 objects...
100% (22/22) done
Writing 22 objects...
100% (22/22) done
Total 22 (delta 0), reused 0 (delta 0)
refs/heads/master: 0000000000000000000000000000000000000000 -> 74bbfc838d4984ee81d5560daee3511fe044d36e
Finally! And checking the gitorious site, the code has been pushed!
(You can get your push and pull urls from the mainline page.
To get started locally with an existing project, just use the pull url
git clone git://gitorious.org/rur/mainline.git
Now, if I can figure out the best way to get an svn mirror from gitorious, I’ll be in business!
Source (and a good tutorial): A tutorial introduction to git (for version 1.5.1 or newer)
A final note: the project referenced here is not quite fully baked, so use at your own risk…