Recently to do a source management server, weigh a bit or git the most suitable, set up a server before looking at some windows on the Internet to build a git server post, feeling is relatively simple, there is not much to configure the place, so began to do.
I chose gitfor windows + tortoisegit + copssh
Gitfor Windows http://msysgit.github.io/Latest version of git-1.9.4-preview20140611
Putty used to test the SSH connection also need tools Puttygen used to convert copssh generated private keys, they are two different formats, the connection is not aware of the problem will be here, I planted in this hole.
First install copssh gitfor windows, tortoisegit installation process is relatively simple, do not want to list too many pictures, do not know how to install the mother to find degrees.
After installation, there are a few points to note:
1. Configure Tortoisegit:tortoisegit>settings
Configure the Git path.
2. Create a GIT account Administrator privilege
3. Activating a git user in copssh
User activation succeeds, the following generates public and private keys
Enter the password, which is the SSH key login password. Private key name, the private key is placed by default under the COPSSH installation directory \icw\home\ user name, the public key is in the \icw\home\ user name \.ssh The following name is: Authorized_keys
OK, the public key and private key are generated successfully, the following open Puttygen convert the private key to putty format
Click Load to select the PRIVATE_KEY.PPK file you just generated, enter the password
To save the private key, click Save Private Key, do not overwrite the original private key, COPSSH private key format is not the same as the Putty private key format, test SSH connection with Puttygen generated private key
Client git connects to the SSH server with the private key generated by COPSSH. I just started to build the server when the client putty generated is the private key, putty test Connection no problem, with
Git connection is always reported without permission, depressed a day later only to find out the problem here. Technology to improve access to www.cgzhw.com game Programming network is a very good technology site.
4. Locate the COPSS installation directory C:\Program Files (x86) \icw\etc
The following sshd_config, with Ssh_config file
Passwordauthentication set to No
Port is set to 22
Firewall open port 22 with telnet command link to see if you can connect, no problem.
according to its own installation directory, C:\Program Files (x86) \git\libexec\git-core directory Git.exe, Git-receive-pack.exe, Git-upload-archive.exe, Git-upload-pack.exe Copy to c:\program Files (x86) \icw\bin directory
c:\program Files (x86) \git\bin directory libiconv-2.dll copy to c:\program Files (x86) \icw\bin directory
Use Putty to test if you can connect to the server
Fill in the server name port
Author option, import the private key click Open, if you can connect the SSH server to establish the success.
5. Client git configuration
(The best practice is to use ssh-keygen-t RSA to generate the public key and private key to the server \icw\home\ user name \.ssh below Authorized_keys
The private key is placed in the client user name/.ssh directory)
Place the generated private key in the client user name/.ssh directory
Add config file under the same directory, note that there is no extension
File enter the following content
Host Server #执行git命令时服务器别名 #
HostName 192.168.1.110 #这里是你服务器的地址 #
User git #登陆服务器用户名 #
Identityfile ~/.SSH/PRIVATE_KEY.PPK #私钥地址 #
6. Server-side create a folder with Tortoisegit under \icw\home\ user name Test.git
Right-click Git Create repository here. Tick make it Bare (No working directories) to create an empty warehouse
7. Client execution $git Clone [email protected]:test.git Enter password
OK, cloning successful this git server is set up!
Problems you may encounter:
A. The private key should not be confused with the Putty connection with the Git connection is two different private keys, the wrong private key is the word will be error:
Permission denied (keyboard-interactive).
Fatal:could not read from remote repository.
This can be done if there is a problem with the private key if this happens:
To the server-side activation password authentication,
Locate the COPSS installation directory C:\Program Files (x86) \icw\etc
The following sshd_config, with Ssh_config file
Passwordauthentication set to Yes
In this case, the connection server needs to enter the user password of the git user, login through the user name, do not go through the key verification, if the connection is successful, it must be a private key problem.
B. Missing files
I encountered a lack of libiconv-2.dll when I was cloning.
git hints/user/bin/git-upload-pack.exe:error while loading shared Libraies:libiconv-w.dd:cannot open Shared object file: No such file or directory
Simply copy libiconv-2.dll from the C:\Program files (x86) \git\bin directory to C:\Program files (x86) \icw\bin directory.