Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setup a Git server with msysgit on Windows [closed]

People also ask

Can you run a Git server on Windows?

Simple. The installation is very easy and you can manage everything from a nice and clean graphical interface. You can use your current Windows infrastructure and Bonobo Git Server runs on your IIS.

Do I need Git for Windows if I have WSL?

It is recommended to install the latest Git for Windows in order to share credentials & settings between WSL and the Windows host.

Can I install Git via the command line on Windows?

To install Git, navigate to your command prompt shell and run the following command: sudo dnf install git-all . Once the command output has completed, you can verify the installation by typing: git version .


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.


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


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.


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


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


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.