Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Self-host remote git repository on Windows server

Tags:

git

windows

We have a computer on our local network designated as 'the server', that runs Windows XP, where we keep the shared folders and stuff that should be visible to all.

How do I create a remote Git repository on it, and setup it so different people on different computers on the local network can pull/push?

I don't care which protocols are used - http://, ssh://, file://, git:// are all fine.

like image 485
sashoalm Avatar asked Sep 18 '13 13:09

sashoalm


People also ask

How do I create a remote git repository in Windows?

Using Windows Explorer, find the local directory containing your files, right click on it and choose Git GUI Here, then Create New Repository. Enter the path of the local directory in the popup window, and click Create. This will create all the necessary files in your local directory for the local repository.

Can I host my own git repository?

Git allows you to host your own Git server. Instead of setting up your own server, you can also use a hosting service. The most popular Git hosting sites are GitHub and Bitbucket. Both offer free hosting with certain limitations.

Should you run your own git server?

In cases like these or when you want more control, the best path is to run Git on your own server. Not only do you save costs, you also have more control over your server. In most cases a majority of advanced Linux users already have their own servers and pushing Git on those servers is like 'free as in beer'.


1 Answers

Edit: I recently found about Bonobo Git Server - it is a free and open-source Git Server for Windows and IIS, licensed with an MIT license. I haven't tested it myself yet, but you can give it a try.

There is also this CodeProject article - Step by Step Setup Git Server on Windows with CopSSH + msysGit and Integrate Git with Visual Studio


Old answer: In the end, I did as @meagar suggested - I created a shared folder on the server, and I followed this tutorial, the part about using Git Gui. Note that we use pushd/popd because CD does not support UNC paths:

pushd \\remote-pc\SharedDocs\MyRemoteGitRepo1
git init --bare
popd

Now all you need to do is connect your local repo to remote one. Note that you need to use forward slashes for git remote add origin, or it won't work:

cd C:\Workspace\MyLocalGitRepo1
git remote add origin //remote-pc/SharedDocs/MyRemoteGitRepo1

And finally you can push your work to the remote repo:

git push origin master
like image 69
sashoalm Avatar answered Oct 13 '22 00:10

sashoalm