Preface or from where did the "crazy" idea to put Git on Windows
I work in one not very big IT-company, which sells its own and other people's software solutions, deals with implementation projects, provides customer support, conducts training and then everything is in the same spirit. Until recently, everything was fairly well organized in my small development team and we even had our own fairly powerful server. But something unforeseen happened and, at the behest of the evil rock, one of the company's servers flew, and the management decided to install our server in the development department instead. We were offered a "temporary" move to any of the general purpose servers.
And now attention! Only we are alone in the whole company working on Linux, and all the others are sitting exclusively on Windows and the server is also under the control of the server editions of the OS from Bill Gates. And if the transfer of the Redmine database does not cause any special questions, then the task of raising the server for Git on the Windows server immediately put me in a dead end. But a few hours spent searching gave me a simple, working solution.
Git can work with four network protocols for data transfer: local, Secure Shell (SSH), Git and HTTP.
I did not begin to consider the first option, since it implies the presence of network balls open for public access. Assume that using domain group policies, you can protect data from being accidentally deleted by a trainee-seller. But how to work from home? For a few “weekend commits” to raise VPN?
We read further and see:
SSH is the only network protocol that provides both read and write access. The other two network protocols (HTTP and Git) in most cases give access only to reading, so even if they are available to you, you still need SSH to write.
The path to the final goal has already become less vague: you first need to install an SSH server, and then install one of the many Git builds for Windows (the 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 could find all the solutions in this area, but I definitely did not miss the most popular ones. So:
Cygwin . As part of the project to transfer 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 the magazine “Windows IT Pro” No. 7 for 2001 - SSH in Windows .
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 version and the possibility of free private use .
KpyM Telnet / SSH Server . Bad reviews are not noticed. But I am embarrassed that their site has not been updated since 2009, as well as on the official forum, somehow lifeless. On the other hand, if the product is free and does its job, then there is no point in developing. I liked the presence in their FAQ a list of other solutions for SSH under Windows. I recommend to look.
Copssh . A product from the Norwegian company ITeF! X, in which they added a beautiful GUI administrator 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 under Windows on StackOverflow .
Random find
Actually, under the impression of responses to StackOverflow, I already relaxed and decided to go along the beaten track by my predecessors. But while studying the ITeF! X website, I found that they have a more suitable product for my purposes - gitwin . This turned out to be the very Git server I need for Windows.
At first I didn’t believe my eyes - if such a miracle product exists, then why is it still not blown about at every turn. The answer was found in the news of the company - as it turned out, the software product was only shared with the public only half a 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 special demand (from January 2012 on the company's official forum there are only two topics 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
Itefix installer
The site has a whole section devoted to installing the package . In addition to describing the process of “launching the installer” -> “next” -> “next” -> “ready”, the company representatives were not too lazy to record all this on video and uploaded to YouTube. It is not entirely clear why this was done and the most important thing is not clear for whom?
Another section highlighted for use . They described the activation of a new user for SSH access, the creation of a pair of keys and an empty repository. And also, apart from the description with the text, a recorded training video is given:
Install, configure and test the Git server
I installed the gitwin edition of the “free edition” on our server and can only share this experience.
1. We start by downloading the installer from the product page .
2. Run the installer and ask us where to install the product. I left the 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 home directory of the git user will also be created right there “C: \ Program Files (x86) \ ICW \ home \ git \”. If there is a premonition of problems with access rights, you can change to a less problematic directory for you.
3. The installation process displays messages about creating two users “SvcCOPSSH” and “git”. The “OpenSSHServer” service will work under the first user, and the second is needed to maintain the repositories. Passwords to these users can be found at the end of the installation process, if you click on "Show details". I advise you to copy the output to the buffer on the right click and save it just in case.
3.1. Rechecking the list of users showed that the installer quietly created another user - “sshd” with the description “copSSH privilege separation user” and turned it off himself. It is not clear and suspicious ...
4. Most likely, because of the edition of the “free edition”, further 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 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 (select from bash, sftponly and false) and set the optional checkboxes. Here we read carefully:
4.1. If we need a pair of keys, then we leave the “Create keys for public key authentication” enabled by default. With password authentication, you can remove ...
4.2. If the user is planning to use his native user directory from C: \ Users \ (or maybe someone still has C: \ Documents and Settings \), then leave the default checkboxes "remove copssh home directory if it exists" and "Create link to user's real home directory". I risked removing them, and thus all my repositories will be hidden deep in the Program Files system catalog.
5. After activating the user and creating 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 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 the empty repository, threw a few files into it and pushed it back. There were no problems. I moved to another directory and again cloned the repository - this time it was no longer empty and contained my commit with files. Thus, from my workstation, the differences between working with the Git repository on the previous Ubuntu server and on the new Windows server were not noticed!
Conclusion
Successfully found gitwin turned out to be exactly the solution I was looking for - it runs under Windows and creates an illusion for users that they work with a full-fledged remote repository. Gluck has not yet noticed. But if I find it, I will definitely add this article.
I hope that the collected materials will be useful to someone. And I want to wish you are not afraid to spend a few hours searching, if you are not sure that the most relevant information is in your head. After all, if I had initially visited StackOverflow and performed everything on detailed step-by-step instructions from Tim Davis, I would not have known about the existence of a shorter way, when the entire infrastructure rises and tunes in literally a dozen mouse clicks. Successes!
Afterword. Success stories from habrauser
I, like Socrates, with every new quantum of knowledge, understand how much more I still do not know. In the comments, colleagues describe a positive experience on the topic I have set, which is a sin to ignore. So:
A1lfeG together with its team are far from Linux, but nevertheless their installation of the central Git repository was pretty simple. In this they were helped by the product SCM Manager .
dshstershares experience on successful installation on the server exclusively msysgit. To be honest, I read this message in Q & A, but this is not my case. The instruction is more concerned with the use of Bitbucket and Github. A shared folder is offered for general use on the local network, and an embedded web server for viewing the repository. I note that since the release of 1.8.4, the web server and some of the other utilities have been removed: “Some commands are not supported yet;namely: git archimport, git cvsexportcommit, git cvsimport, git cvsserver, git instaweb, git shell "
IamKarlson responds well to the decision Bonobo Git Server , which is used at his work. As a plus for myself, I note the use of the IIS web server, which is already working for us.