eonil
eonil

Reputation: 86065

How to use a git repository as a svn:external?

SVN offers external source link via svn:external feature. And I'm using a module from a Git repository. Can I use this Git repository as an external source?

My module Git repository is in Github. So Github specific way is also welcome.

Upvotes: 6

Views: 2870

Answers (3)

Schwern
Schwern

Reputation: 165110

A repository on Github can act like a Subversion repository. See this blog post about their improved SVN support. It seems to be very slow, but it works.

UPDATE Subversion support on GitHub ended Jan 2024.

Another solution for putting a git repository inside a SVN repository would be to set svn:ignore on the nested repository directory and use a Makefile to clone and update the git repository.

cd svn-repository
svn propset svn:ignore gitdir .

Then do something like this to your Makefile or other build system.

GITREPO=git://github.com/schwern/perl5i.git
GITDIR=gitdir

all : $(GITDIR)

$(GITDIR)/.git :
    git clone $(GITREPO) $(GITDIR)

$(GITDIR) : $(GITDIR)/.git
    cd $(GITDIR) && git pull

First call to make will clone the git repository. Subsequent calls will do an update.

I like this solution better. It doesn't rely on the git repository being on Github nor does it rely on emulation. The git repository can be worked on as a git repository rather than having to go through emulation where clashing concepts between git and SVN will likely cause problems.

Upvotes: 2

eonil
eonil

Reputation: 86065

Github announced SVN support. https://github.com/blog/626-announcing-svn-support

I added my Github repository as a svn:external directly.

Upvotes: 2

Blender
Blender

Reputation: 298326

Just fetch the tarball or zipball from GitHub using this URL:

https://github.com/UserName/ProjectName/zipball/master

Or if you prefer tarballs:

https://github.com/UserName/ProjectName/tarball/master

They are snapshots of the code, zipped up.

Upvotes: 0

Related Questions