Windows上使用Cygwin和Gitolite搭建Git服务器
安装Cygwin
- 下载 setup.exe
- 打开setup.exe, 选择Install from Internet
- 选择安装Cygwin到C:\cygwin
- 选择存储下载文件的目录为C:\
- 选择下载站点的镜像
- 选择安装以下软件包:
- Net | openssh (不要选成openssl)
- Devel | git
- Devel | git-completion
- Devel | git-gui
- Devel | git-svn (如果需要同时提交到svn)
- Devel | gitk
- Editors | vim
集成Cygwin和Windows Security
- 打开C:\cygwin\Cygwin.bat
-
$ bin/cyglsa-config
Warning: Registering the Cygwin LSA authentication package requires administrator privileges! You also have to reboot the machine to activate the change.
Are you sure you want to continue? (yes/no)
- 选择yes
- 重启Windows
搭建SSH服务器
- 打开C:\cygwin\Cygwin.bat
-
$ ssh-host-config
*** Info: Generating /etc/ssh_host_key
*** Info: Generating /etc/ssh_host_rsa_key
*** Info: Generating /etc/ssh_host_dsa_key
*** Info: Generating /etc/ssh_host_ecdsa_key
*** Info: Creating default /etc/ssh_config file
*** Info: Creating default /etc/sshd_config file
*** Info: Privilege separation is set to yes by default since OpenSSH 3.3.
*** Info: However, this requires a non-privileged account called 'sshd'.
*** Info: For more info on privilege separation read /usr/share/doc/openssh/README.privsep.
*** Query: Should privilege separation be used? (yes/no)
- 选择yes
*** Info: Note that creating a new user requires that the current account have
*** Info: Administrator privileges. Should this script attempt to create a
*** Query: new local account 'sshd'? (yes/no)
- 选择yes
*** Info: Updating /etc/sshd_config file
*** Info: Added ssh to C:\WINDOWS\system32\driversc\services
*** Warning: The following functions require administrator privileges!
*** Query: Do you want to install sshd as a service?
*** Query: (Say "no" if it is already installed as a service) (yes/no)
- 选择yes
*** Query: Enter the value of CYGWIN for the daemon: []
- 输入tty
*** Info: The sshd service has been installed under the LocalSystem
*** Info: account (also known as SYSTEM). To start the service now, call
*** Info: `net start sshd' or `cygrunsrv -S sshd'. Otherwise, it
*** Info: will start automatically after the next reboot.
*** Info: Host configuration finished. Have fun!
- 配置结束,确认端口22可用。启动服务:sc start sshd
允许SSH客户端访问
- 创建一个名为git的用户,设置密码,并确保密码不会过期。
- 在Cygwin Bash中,执行命令: mkpasswd -l -u git >> /etc/passwd
验证下SSH登录
- 打开Cygwin Bash
-
$ ssh git@10.0.2.15
Administrator@china-fe1bdcde5 ~
$ ssh git@10.0.2.15
The authenticity of host '10.0.2.15 (10.0.2.15)' can't be established.
ECDSA key fingerprint is 5d:a6:81:98:43:f