---
title: "(转) GIT WindowsXP下搭建Git服务器_4"
author: "ft28"
date: "2013-02-25T08:04:11Z"
tags: []
categories: ["非技术"]
slug: "git-windowsxp-git-4"
draft: false
lastmod: "2013-01-21T13:43:23Z"
id: 1773057
url: "https://ft28.iteye.com/blog/1773057"
---

### WindowsXP下搭建Git服务器

**您的评价**:

     

力荐

 [](/admin/blogs/)**收藏该经验**

 

Git没有客户端服务器端的概念，但是要共享Git仓库，就需要用到SSH协议（FTP , HTTPS , SFTP等协议也能实现Git共享，此文档不讨论），但是SSH有客户端服务器端，所以在windows下的开发要把自己的Git仓库共享出去的话，就必 须做SSH服务器。

一、**安装GIT**

Windows下使用msysgit，下载地址：[http://code.google.com/p/msysgit/](http://code.google.com/p/msysgit/)

本文使用Git-1.7.8-preview20111206.exe 安装要点步骤如下：

![WindowsXP下搭建GIT服务器 ](http://static.open-open.com/lib/uploadImg/20120204/20120204193904_625.gif)![WindowsXP下搭建GIT服务器 ](http://static.open-open.com/lib/uploadImg/20120204/20120204193904_700.gif)![WindowsXP下搭建GIT服务器 ](http://static.open-open.com/lib/uploadImg/20120204/20120204193904_819.gif)

安装完成后，可以使用Git bash在命令行模式下操作git

![WindowsXP下搭建GIT服务器 ](http://static.open-open.com/lib/uploadImg/20120204/20120204193905_451.gif)

![WindowsXP下搭建GIT服务器 ](http://static.open-open.com/lib/uploadImg/20120204/20120204193905_619.gif)

 

**二、安装CopSSH**

安装CopSSH之前先确保防火墙开启了SSH端口，这个虽然不影响CopSSH的安装，但是影响SSH访问，所以写在前面。

![WindowsXP下搭建GIT服务器 ](http://static.open-open.com/lib/uploadImg/20120204/20120204193905_169.gif)

CopSSH是windows下的SSH服务器软件，下载地址baidu之，本文使用的是Copssh\_4.1.0\_Installer.exe，安装要点如下：

![WindowsXP下搭建GIT服务器 ](http://static.open-open.com/lib/uploadImg/20120204/20120204193905_343.gif)![WindowsXP下搭建GIT服务器 ](http://static.open-open.com/lib/uploadImg/20120204/20120204193906_558.gif)

安装完成后，到控制面板中新建一个管理员账户root，用这个账户来共享SSH。然后你在账户管理中会看到之前的SvcCOPSSH账户。

![WindowsXP下搭建GIT服务器 ](http://static.open-open.com/lib/uploadImg/20120204/20120204193906_126.gif)

打开copssh控制面板

![WindowsXP下搭建GIT服务器 ](http://static.open-open.com/lib/uploadImg/20120204/20120204193906_515.gif)

将root用户添加到CopSSH用户中，为简单操作，允许使用密码认证方式

![WindowsXP下搭建GIT服务器 ](http://static.open-open.com/lib/uploadImg/20120204/20120204193906_828.gif)![WindowsXP下搭建GIT服务器 ](http://static.open-open.com/lib/uploadImg/20120204/20120204193906_875.gif)

若是不允许密码认证，则需要使用公钥密钥方式认证，不在本文讨论。

 

**三、CopSSH中使用GIT**

现在已经安装GIT和CopSSH，接下来需要做的就是让CopSSH可以使用GIT的命令，这样不仅能够远程SSH管理GIT服务器，而且可以将GIT仓库通过SSH共享。具体的操作方法是将GIT的某些命令程序和动态链接库复制到CopSSH安装目录下即可。

l  将$ Git\\libexec\\git-core目录下的git.exe , git-receive-pack.exe , git-upload-archive.exe , git-upload-pack.exe复制到$ICW\\bin目录下

l  将$Git\\bin目录下的libiconv-2.dll复制到$ICW\\bin目录下

重启CopSSH即可