tags:

views:

1928

answers:

5

I keep a lot of stuff in git repositories, out there on the net. The problem is that I often find myself on machines that don't have git, and where I also don't have root access. I don't necessarily need to commit changes back to the repo, just get the current master of the git project.

Is there any way to download a git repo, without having git itself? The ideal solution would be some kind of portable shell script.

Thanks!

+1  A: 

Even if you could, you'd still need git to get your working directory populated?

Lieven
My thought as well.
T.E.D.
+5  A: 

Can you add a web-based Git browser to the computers hosting these repositories? Something like Gitweb or similar?

Jess
+10  A: 

On the server with the git repository, create a shell script that exports and zips the code, then download that zip from the other machines.

For example:

cd /pub/git/project.git
git archive --format=zip --prefix=project/ HEAD > /home/project/public_html/downloads/project-dev.zip


Also, to make this generate HEAD on-demand, use a server-side script to execute the shell script and provide the zip file for download.

Here's a basic CFML script that does this - but it can obviously be written in any server-side language.

<cfset OutputFilename = "#ProjectName#-dev.zip"/>
<cfexecute name="/home/project/latest.sh"/>
<cfheader name="Content-Disposition" value="inline; filename=#OutputFilename#"/>
<cfcontent file="./#OutputFilename#" reset type="application/zip"/><cfsetting showdebugoutput="false"/><cfabort/>


EDIT: The cgit web interface to git supports this out of the box. View any commit and you can download a .zip, .tar.gz or a .tar.bz2

Peter Boughton
@Peter, a case of if the mountain won't come to Muhammad, Muhammad must go to the mountain. Very nice.
Lieven
+2  A: 

It sounds like what you are looking for is something that will let you have a local working directory with your actual git repository remote.

Since that kinda goes against the git philsophy of always having your entire repository history local, I doubt you are going to find anything. Your best bet would probably be to just copy the sources from another git working directory via typical file copy methods (ftp a tarball, or whatever).

EDIT: OOC, does the git client actually require admin access to install for personal use? I understand needing admin to install one of the git servers, but the client should be OK with just user access. Try installing (or compiling from sources) just the client.

T.E.D.
Man, so dumb of me not to think of trying to build it from source and install locally! It built cleanly and installed in ~/local, no problem. Heh, thanks for this!
rodarmor
+6  A: 

You can just scp(1) a git repository to your local machine, if you have ssh access to the machine on which the git repository resides. When you want to merge the history, you can scp the new repo back and merge.

Denis Bueno
+1 for the obvious and common sense.
Tim Post
or ssh to a machine with git, then clone the repo, then scp the working dir back to the machine you are on.
Ian Kelling