fighting with git svn and setting up my own git server with gitosis

the last hour I set up my own git server and finally moved my current project mysedcard.tv to git. You may ask “Setting up a git server … isn’t that much work to do?”. Actually,  it’s not.

What happenend: I used git svn to use git locally and svn on my server as I started with svn as scm. Today I wanted to add a plugin as a git submodule to easily track and get updates for this plugin. So I deleted the already existing plugin and readded it as a submodule.

rm -rf vendor/plugin/friendly_id
git add .
git commit -a -m "removing friendly_id plugin from local repo"
git submodule add git://github.com/norman/friendly_id.git vendor/plugins/friendly_id
git submodule init

Now a git status should look like:

# On branch master
# Changes to be committed:
#   (use "git reset HEAD ..." to unstage)
#
#	new file:   .gitmodules
#	new file:   vendor/plugins/friendly_id
#

Finally I added the submodule to my git repo:

git add .
git commit -a -m "Import the friendly_id plugin's current HEAD as a submodule."

Last step was pushing all changes back to my svn server:

macpro:mysedcard sb$ git svn dcommit
Committing to https://svn.basiszwo.com/mysedcard/trunk/frontend ...
	D	vendor/plugins/friendly_id/.gitignore
	D	vendor/plugins/friendly_id/CHANGES
	D	vendor/plugins/friendly_id/MIT-LICENSE
	D	vendor/plugins/friendly_id/README.rdoc
	D	vendor/plugins/friendly_id/Rakefile
	D	vendor/plugins/friendly_id/generators/friendly_id_migration/friendly_id_migration_generator.rb
	D	vendor/plugins/friendly_id/generators/friendly_id_migration/templates/create_slugs.rb
	D	vendor/plugins/friendly_id/init.rb
	D	vendor/plugins/friendly_id/install.rb
	D	vendor/plugins/friendly_id/lib/friendly_id.rb
	D	vendor/plugins/friendly_id/lib/slug.rb
	D	vendor/plugins/friendly_id/tasks/friendly_id_tasks.rake
	D	vendor/plugins/friendly_id/test/database.yml
	D	vendor/plugins/friendly_id/test/fixtures/post.rb
	D	vendor/plugins/friendly_id/test/fixtures/posts.yml
	D	vendor/plugins/friendly_id/test/fixtures/slugs.yml
	D	vendor/plugins/friendly_id/test/fixtures/user.rb
	D	vendor/plugins/friendly_id/test/fixtures/users.yml
	D	vendor/plugins/friendly_id/test/schema.rb
	D	vendor/plugins/friendly_id/test/sluggable_test.rb
	D	vendor/plugins/friendly_id/test/test_helper.rb
	D	vendor/plugins/friendly_id/test/unique_column_test.rb
	D	vendor/plugins/friendly_id/uninstall.rb
Committed r833
	D	vendor/plugins/friendly_id/Rakefile
	D	vendor/plugins/friendly_id/README.rdoc
	D	vendor/plugins/friendly_id/.gitignore
	D	vendor/plugins/friendly_id/init.rb
	D	vendor/plugins/friendly_id/CHANGES
	D	vendor/plugins/friendly_id/install.rb
	D	vendor/plugins/friendly_id/MIT-LICENSE
	D	vendor/plugins/friendly_id/uninstall.rb
	D	vendor/plugins/friendly_id/test/test_helper.rb
	D	vendor/plugins/friendly_id/test/schema.rb
	D	vendor/plugins/friendly_id/test/database.yml
	D	vendor/plugins/friendly_id/test/unique_column_test.rb
	D	vendor/plugins/friendly_id/test/sluggable_test.rb
	D	vendor/plugins/friendly_id/test/fixtures/user.rb
	D	vendor/plugins/friendly_id/test/fixtures/users.yml
	D	vendor/plugins/friendly_id/test/fixtures/post.rb
	D	vendor/plugins/friendly_id/test/fixtures/posts.yml
	D	vendor/plugins/friendly_id/test/fixtures/slugs.yml
	D	vendor/plugins/friendly_id/tasks/friendly_id_tasks.rake
	D	vendor/plugins/friendly_id/lib/friendly_id.rb
	D	vendor/plugins/friendly_id/lib/slug.rb
	D	vendor/plugins/friendly_id/generators/friendly_id_migration/friendly_id_migration_generator.rb
	D	vendor/plugins/friendly_id/generators/friendly_id_migration/templates/create_slugs.rb
r833 = 1a4c45c4ce55b53e14d70892f7d2edb4d1ad9396 (trunk)
No changes between current HEAD and refs/remotes/trunk
Resetting to the latest refs/remotes/trunk
	A	.gitmodules
RA layer file already exists: File '/mysedcard/trunk/frontend/vendor/plugins/friendly_id' already exists at /usr/local/git/libexec/git-core/git-svn line 492

Arrrrgggghhhhhh! WTF? …

After playing around with svn and git svn I recognized that I would need to much time to fix all that crap again. As this wasn’t the first time I had problems with git svn I decided to have my own git server. Another (possibly easier) way to move to git is using github. In my case I want to gather some more experience with git so I decided to have my own git server.

Thanks to Garry Dolley and his post about setting up a git server!! It couldn’t be easier!

All you need is root access to your server and follow his instructions.

So, have fun using your own git server :)

Sources:
http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way
http://github.com/norman/friendly_id/tree/master
http://github.com/guides/using-git-submodules-to-track-plugins
http://woss.name/2008/04/09/using-git-submodules-to-track-vendorrails/

Leave a Reply