views:

2827

answers:

5

I have a working copy repository that I've been working in no problem; the origin for this repository is on GitHub.

I'd like to make my working copy repository available as the origin for my build machine (a VM on another physical host), so that commits I make to my working copy can be built and tested on the build machine without having to go via GitHub first. I already have a build for the GitHub repository going, but I'd like this to be a "golden" repository/build; i.e., if something goes in there, the build against GitHub should be guaranteed to pass.

I've looked at the documentation on Git URLs, and see that there's the option of using a URL in the form git://host.xz[:port]/path/to/repo.git/ (see, e.g., git-clone documentation). I want to do this in the simplest possible way, with the minimum of configuration: I don't want to have to set up an SSH daemon or web server just to publish this to my build machine.

I'm running Windows 7 x64 RC, I have MSysGit and TortoiseGit installed, and I have opened Git's default port (9814) on the firewall. Please assume working copy repo is at D:\Visual Studio Projects\MyGitRepo, and the hostname is devbox. The build machine is Windows Server 2008 x64. I have been trying the following command on the build machine, with the associated output:

D:\Integration>git clone "git://devbox/D:\Visual Studio Projects\MyGitRepo"
Initialized empty Git repository in D:/Integration/MyGitRepo/.git/
devbox[0: 192.168.0.2]: errno=No error
fatal: unable to connect a socket (No error)

Am I missing something?

+22  A: 

There are five possibilities to set up a repository for pull from:

  • local filesystem: git clone /path/to/repo or git clone file://path/to/repo. Least work if you have networked filesystem, but not very efficient use of network. (This is almost exactly solution proposed by Joakim Elofsson)
  • HTTP protocols: git clone http://example.com/repo. You need any web server, and you also need to run (perhaps automatically, from a hook) git-update-server-info to generate information required for fetching/pulling via "dumb" protocols.
  • SSH: git clone ssh://example.com/srv/git/repo or git clone example.com:/srv/git/repo. You need to setup SSH server (SSH daemon), and have SSH installed on client (e.g. PuTTY on MS Windows).
  • git protocol: git clone git://example.com/repo. You need to run git-daemon on server; see documentation for details (you can run it as standalone process only for fetching, not necessary run as service). git-daemon is a part of git.
  • bundle: You generate bundle on server using git-bundle command, transfer it to a client machine in any way (even via USB), and clone using git clone file.bndl (if clone does not work, you can do "git init", "git remote add" and "git fetch").

What you are missing in your example is probably running git-daemon on server. That, or misconfiguring git-daemon.

Unfortunately I cannot help you with running git-daemon as service on MS Windows. There is nothing in announcement for last version of msysGit about git-daemon not working, though.

Jakub Narębski
Ok, so I need to install *something* or copy it over a bundle manually each time (possibly scripting it via, I guess. Do the first three options need git-daemon as well?
alastairs
Only "git protocol" option needs running git-daemon on server. Only "SSH" and "HTTP" options require extra tools: either sshd (ssh server) or web server. The bundle solution is manual solution.
Jakub Narębski
Although the question was about 'pull', the poster must be warned from running 'git push' afterwards, as the repository he is cloning from is non-bare.
yhager
Please could you elaborate on this, @yhager?
alastairs
http://git.or.cz/gitwiki/GitFaq#non-bare
Jakub Narębski
Note to anyone else trying the local filesystem option: remember to escape the leading backslashes on the UNC path! :-)
alastairs
+2  A: 

In addition to Jakub Narębski's answers, there is anotherway, more in-line with your original question. You could clone from github like you usually do, then when you want to perform a one-off pull from your local repo, just do this:

git pull /path/to/repo master

(instead of master you can put any branch name.)

Pod
A: 

The ssh route works well but does require a remote ssh server. If you have Windows platform then Cygwin provides a working ssh server that works with Git, but manually upgrade Git if using Cygwin Git (I wrote some hints at http://alecthegeek.wordpress.com/2009/01/21/top-tip-upgrade-git-on-cygwin/).

Alec the Geek
A: 

I recently changed one of my git projects to replicate itself to an HTTP server using sitecopy to do the actual file uploads.

It's pretty easy, just use git update-server-info then mirror the .git directory to some http-accessible directory on your server. I used 'project.git', which is fairly common.

Git pull from http://site/project-git works like a champ, and I don't have to have anything on the server except FTP access, though sitecopy supports webdav as well.

I don't recommend using sitecopy, however, as it doesn't keep multiple machines in sync well. For my project, the HTTP repository is readonly, and gold updates come from just one machine, so it works well enough.

davenpcj
A: 

My system lists 9418 as the port over which git communicates. You seemed to have opened a different port.