How to set up a GIT server on windows

https://github.com/msysgit/msysgit/wiki/Setting-up-a-Git-server-on-Windows-using-Git-for-Windows-and-CopSSH

You will need:

  • CopSSH 3.1.4 (the latest free version)
  • Git for Windows 1.7.10 (or later)

On the server:

  1. Install Git for Windows, selecting the “Run Git and included Unix tools from the Windows Command Prompt” when prompted. This option will install a bin folder inProgram Files\git that will be placed into your path thus taking possibly taking precedence over other tools.
  2. Open up a bash prompt and run the following commands (these hard links are necessary, because CopSSH 3.0.3 appears to have an issue with symbolic links):
    cd /bin
    ln -f ../libexec/git-core/git-upload-pack.exe git-upload-pack.exe
    ln -f git.exe git-receive-pack.exe
    
  3. Install CopSSH
  4. Right-click “Computer” in the start menu and select “Manage”. Select “Local Users and Groups” and proceed to create Windows users for all Git users. It is not required, but I recommend you give them passwords.
  5. Activate all the Windows users under the CopSSH “01. Activate a User” option. Untick the “Create link to user’s real home directory” option when doing so. Create new public and private keys if you don’t have keys already.
  6. If you already have private and public keys, copy them to the …Program Files\ICW\home\{username} folder and call them {username}.key and {username}.key.pub. Also copy the public key to …ICW\home\{username}\.ssh\ and rename it to “authorized_keys”.
  7. Create your Git repositories (git init –bare …) and make sure that you grant appropriate access rights to the repository folders for all users created in step 4. (If a user does not have write access to the repository folder then an attempt to push to the repository will fail.)
  8. If you need remote access to the server, forward the SSH protocol (port 22, UDP and TCP) from your router to the server.
  9. Reboot the server so the changes to the Path environment variable can take effect.

On the workstation:

  1. Copy the private key generated in step 5 (or the one you used in step 6) to the .ssh subfolder in your user profile (typically c:\Users\Administrator\.ssh) and rename it to “id_rsa”.
  2. If you’ve generated the private key with a passphrase and you wish to remove it, run “ssh-keygen -p” in a command prompt and specify a blank new passphrase. If you don’t remove the passphrase you will be prompted for the password every time you interact with the server.
  3. If you’re using TortoiseGit, remember to specify in the installer that you’re using OpenSSH.
  4. To check out a repository: git clone {username}@{servername}:{repodriveletter}:/{repopath}

See Also

Once you have your sever setup and the users enabled through CopSSH, check out theofficial git docs for a more detailed explanation of actually setting up your repos on the server and then doing your initial commits from your workstation.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s