163

My friends and I are trying to setup Git for Windows using the tutorial Git Server: Gitosis and Cygwin on Windows, but we just keep running into problems.

What would a "Setup Git Server" guide for Windows using msysgit be like?

There is a comment in the tutorial above suggesting it can't be done with msysgit because gitosis requires the use of an SSH Server and Bash? What is a step by step guide (as there is not one available)?

  1. Install mysisgit

  2. ?

Kara
  • 6,115
  • 16
  • 50
  • 57
  • You can try Git Candy, A Git platform based on ASP.NET MVC. Source on:http://github.com/Aimeast/GitCandy, Demo on: http://git.53wb.com/ – Aimeast Jan 07 '14 at 14:19
  • * [Git for Windows Developers](http://www.lostechies.com/blogs/jason_meridth/archive/2009/06/01/git-for-windows-developers-git-series-part-1.aspx). 3 parts, this is a link to the first one. Good one! * [An Illustrated Guide to Git on Windows](http://nathanj.github.com/gitguide/tour.html) * [Git Extensions](http://code.google.com/p/gitextensions/) (videos) – Rook Sep 27 '09 at 06:37
  • I used the tool at http://www.windowsgit.com as Computer Linguist suggested after trying (and failing) with the methods above. It was ridiculously easy and just worked. Well worth the $9, IMO. – Edward Anderson Jun 03 '11 at 14:16

12 Answers12

79

I found this post and I have just posted something on my blog that might help.

See Setting up a Msysgit Server with copSSH on Windows. It's long, but I have successfully got this working on Windows 7 Ultimate x64.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Tim
  • 2,466
  • 1
  • 21
  • 18
  • 5
    For the record, from what I can tell, at point 5.5 in Tim's instructions, you need to insert the extra command BEFORE the #, not after (otherwise it remains commented out). – Benjol May 04 '10 at 12:21
  • When checking to see if the bashrc is configured correctly by typing echo $HOME, the above guide advises you to use the export command if it doesn't give the correct directory. This will temporarily fix the problem but if you close the console and reopen it, echo $HOME shows the export didn't stick. Follow Benjol's advice in the above comment. This will fix the problem. – Rupert Madden-Abbott Sep 03 '10 at 13:52
  • 1
    You might take a look at http://windowsgit.com. – Lilith River May 06 '11 at 13:07
  • also very easy to use git with winsshd: http://holyhoehle.wordpress.com/tag/winsshd/ – Naveen Nov 24 '11 at 19:17
  • After seeing the warnings in very first line, I was tempted to start a new thred Setting up Git in 2012". But I just want to ask if this has simplified or its "still NOT for faint hearted", like me :D – dejjub-AIS Feb 24 '12 at 06:03
  • 6
    Note that Copssh is not provided on sourceforge and it isn't free anymore as of 2012 Apr. – TiansHUo Mar 07 '12 at 01:19
  • @TiansHUo - actually 3.0.3 is still free. You can see that "NB! As of November 2011, Copssh is a commercial solution. This old but useable version is made freely available to keep related free web content intact." – Tim Apr 24 '12 at 15:00
  • 2
    @Tim, can you repost the content of your blog post here? If your blog goes offline then this answer becomes useless. – Starfish Aug 30 '12 at 21:02
  • 1
    @Starfish - That's what web.archive.org is for! Here's Tim's article on there: http://web.archive.org/web/20100207010332/http://www.timdavis.com.au/git/setting-up-a-msysgit-server-with-copssh-on-windows/ – alldayremix Dec 01 '12 at 05:01
27

Bonobo Git Server for Windows

From the Bonobo Git Server web page:

Bonobo Git Server for Windows is a web application you can install on your IIS and easily manage and connect to your git repositories.

Bonobo Git Server is a open-source project and you can find the source on github.

Features:

  • Secure and anonymous access to your git repositories
  • User friendly web interface for management
  • User and team based repository access management
  • Repository file browser
  • Commit browser
  • Localization

Brad Kingsley has a nice tutorial for installing and configuring Bonobo Git Server.

GitStack

Git Stack is another option. Here is a description from their web site:

GitStack is a software that lets you setup your own private Git server for Windows. This means that you create a leading edge versioning system without any prior Git knowledge. GitStack also makes it super easy to secure and keep your server up to date. GitStack is built on the top of the genuine Git for Windows and is compatible with any other Git clients. GitStack is completely free for small teams1.

1 the basic edition is free for up to 2 users

Daniel
  • 5,602
  • 4
  • 33
  • 36
  • 1
    GitStack is only free for up to 5 users. Once past that limit you're into per-year pricing based on the number of users. See [Pricing page](http://gitstack.com/pricing/) on the GitStack website. – Simon Elms May 17 '12 at 02:19
  • 2
    Note that the original developer of Bonobo Git Server, Jakub Chodounský, says in a [forum post on 1 Jan 2012](http://forum.chodounsky.net/viewtopic.php?f=13&t=65#p352) that he can no longer support the project. – Simon Elms May 17 '12 at 02:29
  • 2
    GitStack is now only free for up to 2 users. – M4N Oct 30 '12 at 22:41
  • 2
    Bonobo is active an project again. – Tomas Kubes Jun 29 '13 at 06:15
  • 2
    Just remember to activate IIS > WWW Services > Application Development Features > ASP.NET 4.5. Bonobo worked for me where GitStack (which couldn't even use the mainstream msysgit) didn't, and Bonobo is open-source and MIT-licensed! This offers a satisfying solution for Windows, as much as I'd prefer to use a Unix machine for this purpose. – Will Aug 06 '13 at 21:41
26

With regards to the reference to the Tim Davis page - Setting up a Msysgit Server with copSSH on Windows - I used this to get a Git server running on Windows 7 Home Premium 64.

Below is a postmortem/update of what I learned in addition to his instructions.

Like Tim Davis said, this was an arduous and frustrating process, at least for me - I'm not too good with integration of this sort, but I learned alot in the process. I hope my pain benefits someone else in the future, because this was an arduous process.

  1. There is a step to copy all the Git executables into your CopSsh bin directory. Instead of copying files and figuring out which files are needed, add the git bin path to your git path. I did so by modifying my .bashrc and CopSsh profile.

    Here's what I added to .bashrc (in your CopSsh and Windows home directory):

    gitpath='/cygdrive/c/Program Files (x86)/Git/bin'

    gitcorepath='cygdrive/c/Program Files (x86)/Git/libexec/git-core'

    PATH=${gitpath}:${gitcorepath}:${PATH}

    Here's what I added to the bash profile (in CopSsh etc/profile):

    gitpath='/c/Program Files (x86)/Git/bin'

    gitcorepath='cygdrive/c/Program Files (x86)/Git/libexec/git-core'

    export PATH="/bin:$syspath:$gitpath:$gitcorepath:$winpath"

    There is some duplication here - it works for me, so someone chime in which is the correct place to modify the path.

  2. The newer msysgit versions might not give you the screen to choose the ssh executable where you choose between the Git ssh and PuTTY ssh. You'll have to set GIT_SSH manually if you use PuTTY.

  3. I didn't follow one part of the instructions and that was installing Tortoise - I used the command line instead as that's how I prefer to learn a vcs like I did with rcs and Subversion and found that to work for me. I had problems with the clone command using ssh. Here's how I did it:

    Git clone using ssh - can't find repository

    This is where I banged my head the most.

  4. The CopSsh install directory was /Program Files (x86)/ICW. I got away with this, but if I were doing it again, I'd use a directory name with no spaces.

  5. These other sources helped me figure things out:

    Another way to setup a Git server on Windows:

    http://code.google.com/p/tortoisegit/wiki/HOWTO_CentralServerWindowsXP

    The client side of things:

    http://toolmantim.com/thoughts/setting_up_a_new_remote_git_repository

    An explanation of Git as a server (not related to Windows, but a more in depth look than installation steps):

    http://progit.org/book/ch4-0.html

    Plus O'Reilly's Version Control with Git - the Remote Repositories chapter.

In retrospect, if I had known how time consuming this would be, I might have started out with Mercurial as I read the install on Windows is easier, but I'll have an opinion on that after I work with Git awhile and then try Mercurial.

Community
  • 1
  • 1
Steve
  • 5,802
  • 12
  • 54
  • 76
  • I'm having trouble with the CopSSH step. The link to CopSSH is not there anymore... I get directed to http://sourceforge.net/projects/sereds/files/ where I can only download cwRsync_4.0.4_Installer.zip instead of the CopSSH installer. Any suggestions? – boo-urns Apr 11 '10 at 05:32
  • This is the link I used: http://www.itefix.no/i2/node/27 – Steve Apr 24 '10 at 15:57
  • 1
    As of November 2011, Copssh is a commercial solution. [Version 3.0.3](http://sourceforge.net/projects/sereds/files/Copssh/3.0.3/) is made freely available. – mateuscb May 27 '12 at 13:49
20

I am not sure why anyone hasn't suggested http://gitblit.com. Pure java based solution, allow HTTP protocol and really easy to setup.

Pritesh Patel
  • 1,969
  • 1
  • 18
  • 32
16

After following Tim Davis' guide and Steve's follow-up, here is what I did:

Server PC

  1. Install CopSSH, msysgit.
  2. When creating the CopSSH user, uncheck Password Authentication and check Public Key Authentication so your public/private keys will work.
  3. Create public/private keys using PuTTygen. put both keys in the user's CopSSH/home/user/.ssh directory.
  4. Add the following to the user's CopSSH/home/user/.bashrc file:

    GITPATH='/cygdrive/c/Program Files (x86)/Git/bin'
    GITCOREPATH='/cygdrive/c/Program Files (x86)/Git/libexec/git-core'
    PATH=${GITPATH}:${GITCOREPATH}:${PATH}
    
  5. Open Git Bash and create a repository anywhere on your PC:

    $ git --bare init repo.git
    Initialized empty Git repository in C:/repopath/repo.git/
    

Client PC

  1. Install msysgit.
  2. Use the private key you created on the server to clone your repo from ssh://user@server:port/repopath/repo.git (for some reason, the root is the C: drive)

This allowed me to successfully clone and commit, but I could not push to the bare repo on the server. I kept getting:

git: '/repopath/repo.git' is not a git command. See 'git --help'.
fatal: The remote end hung up unexpectedly

This led me to Rui's trace and solution which was to create or add the following lines to .gitconfig in your Client PC's %USERPROFILE% path (C:\Users\UserName).

[remote "origin"]
    receivepack = git receive-pack

I am not sure why this is needed...if anybody could provide insight, this would be helpful.

my git version is 1.7.3.1.msysgit.0

Community
  • 1
  • 1
timc
  • 339
  • 4
  • 9
8

GitStack should meet your goal. I has a wizard setup. It is free for 2 users and has a web based user interface. It is based on msysgit.

M4N
  • 94,805
  • 45
  • 217
  • 260
poiuytrez
  • 21,330
  • 35
  • 113
  • 172
  • 1
    [Pricing](http://gitstack.com/pricing/) from the GitStack website: Free for up to 5 users, $299/year for 6-10 users, $499/year for 11-25 users, and so on, up to $2999/year for 500 users. – Simon Elms May 17 '12 at 02:17
  • 1
    GitStack is now only free for up to 2 users. – M4N Oct 30 '12 at 22:50
  • So, 1 user for who is setting up the server , 1user for the client who visiting the server. This limit is too strict. A team of 2 developer is too small in the real world. – ZhaoGang Oct 12 '16 at 06:36
7

There is a nice open source Git stack called Git Blit. It is available for different platform and in different packages. You can also easily deploy it to your existing Tomcat or any other servlet container. Take a look at Setup git server on windows in few clicks tutorial for more details, it will take you around 10 minutes to get basic setup.

Ari0nhh
  • 5,720
  • 3
  • 28
  • 33
Ruslan Platonov
  • 422
  • 4
  • 4
3

You don't need SSH for sharing git. If you're on a LAN or VPN, you can export a git project as a shared folder, and mount it on a remote machine. Then configure the remote repo using "file://" URLs instead of "git@" URLs. Takes all of 30 seconds. Done!

Jon Watte
  • 6,579
  • 4
  • 53
  • 63
2

There may simply not be such a guide. If so, you may not have much luck convincing anybody to write one, because it would be a lot of work.

I would recommend either of two things. The easier one is to follow the guide you have slavishly, which means forgetting about msysgit.

The harder one is to put up a Linux server - perhaps as a guest under Windows using VirtualBox (free) or VMWare or Parallels (pay), and then follow one of the many sets of instructions Google will lead you to. But you will probably find those instructions are insufficient - they usually assume you've already set up an ssh server, for example, so you have to get that info elsewhere. I've done that twice, and can say that unless you're already something of a Linux guru, it will be a struggle.

Bob Murphy
  • 5,814
  • 2
  • 32
  • 35
1

I did what Bob Murphy suggested was the "hard" option.

I installed Ubuntu under VMWare Server (free) at work and then followed this guide on setting up Gitosis. I found it much easier than trying to get it going under Windows. Once it's set up you really don't have to touch it because Gitosis administration can be done from Windows by pushing updated versions of the gitosis.conf file. Any work I do need to do on the server directly is done via PuTTY so I don't have to use the horrible VMWare Server interface.

I've recently been messing around with VirtualBox at home and I've found it much nicer/easier to work with than VMWare Server, so it may be worth looking at that.

Community
  • 1
  • 1
Jacob Stanley
  • 4,704
  • 3
  • 33
  • 36
1

I just wanted to add my experiences with the PATH setup that Steve and timc mentions above: I got permission problems using shell tools (like mv and cp) having Git's shell executables first in the path.

Appending them after the existing PATH instead this solved my problems. Example:

GITPATH='/cygdrive/c/Program Files (x86)/Git/bin' GITCOREPATH='/cygdrive/c/Program Files (x86)/Git/libexec/git-core' PATH=${PATH}:${GITPATH}:${GITCOREPATH}

I guess CopSSH doesn't go along well with all of msysgit's shell executables...

kjellander
  • 156
  • 2
0

I'm using GitWebAccess for many projects for half a year now, and it's proven to be the best of what I've tried. It seems, though, that lately sources are not supported, so - don't take latest binaries/sources. Currently they're broken :(

You can build from this version or download compiled binaries which I use from here.

Ivan Danilov
  • 14,287
  • 6
  • 48
  • 66