Easy GIT Server Installation on Windows
Preface or where the "crazy" idea to put Git on Windows came from
I work in one not-so-large IT company that sells its own and other people's software solutions, deals with implementation projects, provides customer support, conducts training and everything else in the same vein. Until recently, everything was well organized in my small development team and we even had our own rather powerful server. But the unexpected happened and by the will of evil rock one of the company's servers flew, and the management decided to put our development department server in the rack instead. We were offered to “temporarily” move to any of the general purpose servers.
Now attention!Only we alone work in the entire company on Linux, and all the rest are exclusively on Windows, and the servers we have are also running the server editions of the OS by Bill Gates. And if the transfer of the Redmine database does not raise any special questions, then the task of raising the server for Git on the Windows server immediately baffled me. But a few hours spent searching gave me a simple working solution.
First of all, I turned to the documentation for Git , where I read the following:
Git can work with four network protocols for data transfer: local, Secure Shell (SSH), Git and HTTP.
I did not consider the first option, since it implies the presence of network balls open for public access. Suppose that using group policies of a domain, you can protect data from accidental deletion by a sales assistant. But how to work from home? For the sake of a few "weekend commits" to raise a VPN?
We read further and see:
SSH is the only network protocol that provides read and write access. Two other network protocols (HTTP and Git) in most cases give read-only access, so even if they are available to you, you still need SSH for writing.
The path to the final goal has already become less foggy: first you need to install an SSH server, and then install one of the many Git builds for Windows (official msysgit , Git Extensions , TortoiseGit , QGit , etc.)
Choosing an SSH Server for Windows
Using a search engine on the Internet, I made a small selection of current SSH implementations for Windows. I do not pretend that I was able to find all the solutions in this area, but I definitely did not miss the most popular ones. So:
Cygwin . As part of a project to port Linux functionality to Windows, OpenSSH was ported as well . The cygwin1.dll project library with SSH implementation is also used in most other solutions. A simple instruction with pictures on installation and configuration can be found here . And I also recommend reading the article from Windows IT Pro magazine No. 7 for 2001 - SSH on Windows .
freeSSHd. The leader among is mentioned on the forums. It is characterized as easy to use. The license allows free use for commercial purposes. I found instructions for installing and configuring on Win2008 .
WInSSHD . The richest in functionality of the implementations I have seen. This is a good professional security solution. But for my nail, it's a microscope. If someone is interested in the product, then they have a 30-day trial full version and the possibility of free private use .
KpyM Telnet / SSH Server. I did not notice bad reviews. But it bothers me that their site has not been updated since 2009, and also on the official forum is somehow lifeless. On the other hand, if the product is free and does its job, then it makes no sense to engage in development. I liked the presence in their FAQ of a list of other SSH solutions for Windows. I recommend a peek.
Copssh . A product from the Norwegian company ITeF! X, in which they added a beautiful administrator GUI interface and some “best practices” to the windows implementation of OpenSSH. It is this solution that is most recommended in the discussion of raising a Git server for Windows on StackOverflow .
Actually, under the impression of the answers to StackOverflow, I already relaxed and decided to go the beaten path by my predecessors. But when I studied the ITeF! X website, I found that they also have a product more suitable for my purposes - gitwin . It turned out to be the same Git server for me on Windows.
At first, I could not believe my eyes - if such a miracle product exists, then why it is still not trumpeted at every step. The answer was found in company news.- as it turned out, the software product was only released a half month ago (October 11, 2013). More precisely the other day they posted a free version for use. Paid existed before, but apparently did not enjoy much demand (since January 2012 on the official forum of the company there are only two threads created in the gitwin section).
So what is this gitwin? The free version includes:
- Cygwin version 1.7.25
- OpenSSH version 6.3
- Git version 1.8.4
- Installer from Itefix
A whole section on the site is devoted to installing the package . Besides the words describing the process “launching the installer” -> “next” -> “next” -> “done”, the company representatives were not too lazy to record all this on video and uploaded it to YouTube. It is not entirely clear why this was done, and most importantly, it is not clear to whom?
Another section has been allocated to describe the use . Here they described the activation of a new user for access via SSH, the creation of a key pair and an empty repository. And also, in addition to the description, the text gives a recorded training video:
Install, configure, and test a Git server
I installed the “free edition” editions on our gitwin server and can only share this experience.
1. Start by downloading the installer from the product page .
2. Run the installer and we are asked where to install the product. I left by default in "C: \ Program Files (x86) \ ICW". Why might you need to change the path? The fact is that this directory will become the root for Linux utilities and the git user’s home directory will also be created right there “C: \ Program Files (x86) \ ICW \ home \ git \”. If there is a presentiment of problems with access rights, then you can change to a less problematic directory for you.
3. During the installation process, messages about creating two users “SvcCOPSSH” and “git” are displayed. Under the first user, the OpenSSHServer service will work, and the second is needed for servicing the repositories. Passwords to these users can be found at the end of the installation process by clicking on “Show details”. I advise you to right-click to copy the output to the buffer and save just in case.
3.1. Re-checking the composition of users showed that the installer quietly created another user - “sshd” with a description of “copSSH privilege separation user” and disabled it himself. It is not clear and suspicious ...
4. Most likely, because of the free edition, the next steps were different from those described on the site. Instead of the administration console, two items “01. Activate a user "and" 02. Deactivate a user. " But the essence of the process from this has not changed. We launch "01. Activate a user ”and specify the user to activate (in my case, the same git), select the command shell (choice from bash, sftponly and false) and put the optional checkmarks. Here we read carefully:
4.1. If we need a key pair, then leave the “Create keys for public key authentication” enabled by default. With password authorization, you can remove ...
4.2. If the user plans to use his native user directory from C: \ Users \ (or maybe someone still has C: \ Documents and Settings \) then leave the check boxes “remove copssh home directory if it exists” enabled by default and "Create link to user's real home directory." I took a chance to remove them and in this way all the repositories I have will be hidden deep in the Program Files system directory.
5. After activating the user and creating the keys, we can test the entire system for operability. Select the item “03. Start a Unix BASH Shell ”and create an empty repository. I did not shine with wit and repeated the command from the official site:
$ git init --bare / home / git / repo-a
Initialized empty Git repository in / home / git / repo-a /
6. Further testing moved to my working laptop. I successfully cloned an empty repository, threw a few files into it and pushed back. There were no problems. Moved to another directory and cloned the repository again - this time it was no longer empty and contained my commit with files. Thus, from my workstation, there was no difference between working with the Git repository on the previous Ubuntu server and the new Windows server!
The successfully found gitwin turned out to be exactly the solution I was looking for - it runs under Windows and creates the illusion for users that they are working with a full-fledged remote repository. Glukov has not yet noticed. But if I find out, I will definitely supplement this article.
I hope that the collected materials will be useful to someone. And I want to wish you are not afraid to spend several hours searching, if you are not sure that the most relevant information is in your head. After all, if I initially went to StackOverflow and did everything according to a detailed step-by-step guide from Tim Davis, I would not have known about the existence of a shorter way, when the entire infrastructure rises and configures in just a dozen clicks of the mouse. Good luck!
Afterword. Success Stories from Habrausers
Like Socrates, with each new quantum of knowledge, I understand how much more that I still do not know. In the comments, colleagues describe the positive experience on my topic, which is a sin to ignore. So:
A1lfeG with its team is far from Linux, but nonetheless their installation of the central Git repository was quite simple. The SCM Manager product helped them in this .
dshster shares experiencefor successful installation on the server exclusively msysgit. To be honest, I read this post in Q&A, but this is not my case. The instructions are more about using Bitbucket and Github. A shared folder is offered for general use on the local network, and an integrated web server is provided for viewing the repository. I note that starting with release 1.8.4, the web server and some other utilities have been removed: “Some commands are not yet supported on Windows and excluded from the installation; namely: git archimport, git cvsexportcommit, git cvsimport, git cvsserver, git instaweb, git shell ”
IamKarlson speaks well of the Bonobo Git Server solution that he uses at work. As a plus for myself, I note the use of the IIS web server, which already works for us.