首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 操作系统 > windows >

SSH+Git Server on Windows - 在Windows上搭建Git服务器

2012-09-29 
SSH+Git Server on Windows - 在Windows下搭建Git服务器会看英文http://www.jeremyskinner.co.uk/2010/07/

SSH+Git Server on Windows - 在Windows下搭建Git服务器

会看英文

http://www.jeremyskinner.co.uk/2010/07/31/hosting-a-git-server-under-apache-on-windows/

http://www.timdavis.com.au/git/setting-up-a-msysgit-server-with-copssh-on-windows/

?

软件需求:
1.windowXP, win7 都测试通过
2.Copssh_3.1.4_Installer.exe
3.Git-1.7.3.1-preview20101002.exe


搭建git服务器步骤:
1.安装copssh
1.1? 我选择安装路径c:\ICW,其他选项都选默认.
1.2 设置环境变量,系统的Path中添加C:\ICW\bin
1.3 右键 我的电脑,选择 管理,打开 系统工具->本地用户和组->用户,? 在用户窗口点击右键,选择 新用户,用户?? 名输入git,密码输入git.
1.4.选择git用户,右键 选属性, 点击 隶属于->添加,使git用户被添加到administrator组,并拥有administrator权限.
1.5 选择 开始->所有程序->copssh->0.1 activate a user,在user name下拉列表中选择刚刚新建的git用户,点击next,输入 Type a passhrase,并记住输入的Type a passhrase,点击 activate.

2.安装git
2.1? 我选择安装路径c:\git,其他选项都选默认.
2.2 设置环境变量,系统的Path中添加C:\git\bin

3.检验设置
3.1 打开一个cmd,输入 ssh git@127.0.0.1,按照提示输入密码,(我上面设置的是git),出现远程登录,git用户ssh登录成功
3.2 登录成功后,可以使用ls,cd,rm,chmod等命令,但是不能使用git命令,也就是不能使用ssh协议管理git仓库.

4.设置使用ssh协议 管理git 仓库
4.1开始-> CopSSH > Start a unix bash shell.
4.2 cd /Bin
4.3 创建 4个符号连接指向 git.exe, git-receive-pack.exe, git-upload-archive.exe, git-upload-pack.exe:

4.5 启动一个cmd,我准备要把服务器管理的test仓库 拷贝到e:\, ? 所以输入 cd e:\ ,执行拷贝
git clone git@127.0.0.1:../../var/test? test???? (路径是相对路径,相对于git账号登录后的c:\ICW\home\git目录)

4.6拷贝完成.cmd输出.
Cloning into test...
git@127.0.0.1's password:
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (3/3), done.??

4.7 创建git账号信息,用于提交时区分哪个账号提交了什么内容.
登录git账号,输入pwd,输出为/home/git,
输入
touch .gitconfig
echo "[user]" > .gitconfig
echo "name=jackylee" >> .gitconfig
echo "email=orange.jackylee@gmail.com" >> .gitconfig

其他账号创建与创建git账号相同

5 让git 管理其他路径下文件.比如要让git管理e:\project目录
启动cmd,进入e:\project
依次输入
git init
git add .
git commit -m "first commit"

启动一个cmd,进入C:\ICW\var
依次输入
ln -s e:\project? project

现在已经可以使用git clone来管理e:\project目录了
输入:git clone git@127.0.0.1:../../var/project? project_backup


以上一个完整的xp? git服务器已经设置完成.

问题备忘:
?- if cannot push to remote repo
?change the bare = true? in \.git\config
?if is bare option, cannot checkout

? - ssh git@v:..\..\test test
related location
3. c:\git;c:\icw has settings

?

?

?

热点排行