下文来给各位介绍Windows中使用TortoiseGit提交项目到GitLab配置过程,下在全部图片希望对各位带来方便面。
Gitlab默认的配置推荐使用shell命令行与server端进行交互,作为搞SCM的表示无压力,但是作为开发人员还是比较适应windows的GUI图形管理,方便他们将注意力集中到代码编写上,所以今天刚好接着昨天给大家介绍一下使用windows下的git client工具实现将本地代码提交到远程服务器.
解决方案:
环境部署
操作系统 Windows7 x64 Sp1
TortoiseGit TortoiseGit-1.8.11.0-64bit.msi
Git Git-1.9.4-preview20140815.exe
Putty PuTTY 0.63
下载地址: http://yunpan.cn/QaaLGsd23BsWL (访问密码 96d7)
一.部署前的准备工作
安装TortoiseGit,Git,Putty,默认下一步安装即可,其中Git为Git client环境安装包,确保windows包含git环境.
二.配置PuTTY authentication agent
在安装TortoiseGit后,可以选择使用OpenSSH客户端还是使用Putty客户端,如果使用的是默认的Putty客户端,由于TortoiseGit GUI连接不支持server端自定义端口配置,若GitLab使用的SSH端口为自定义端口,则需要使用PuTTY的authentication agent去做一个本地的端口转发.
1.首先使用TortoiseGit自带的Puttygen创建本地的公/私钥对

2.点击Generate按钮,在窗口空白处按照提示晃动鼠标,生成公/私钥对,并保存到本地
其中testkey为公钥,testkey.ppk为私钥


3.将窗口生成的Public key粘贴到GitLab站点具体使用账号的SSh Keys内即完成公钥上传.


4.使用PuTTY连接gitlab服务器,TortoiseGit自带了PuTTy,即Pageant。

击打开 Pageant,右下角,右键 Add Key,选中保存的私钥。



open之前需选择之前本地生成的私钥文件,配置完成。
5.连接成功会在右下角任务栏出现任务图标

三.配置TortoiseGit
1.从windows开始菜单选择TortoiseGit-Setting工具,在对话框里选择Git项,填写相关info

2.在D盘新建一个目录,例如"D:Git",并进入目录右键目录空白处选择"Git Create repository here...",弹出对话框点确认,这样即建立了一个本地Git仓库.


3.在该仓库目录下创建一个测试项目文本文件,右键目录空白处,选择Git Commit -> "master" ...,在弹出对话框里输入提示注释,选择要加入的版本控制文件,确定即可提交.


4.现在只是在本地实现使用Git管理项目,在此界面若显示Success则本地提交成功,接下来点击Push..,把我们的改动递交到Git服务器上.


5.此时会弹出Push对话框,在Ref - Remote栏里设定当前分支名为master,然后点击Destination - Remote栏的Manage按钮.


6.在弹出的设置对话框中按照如图所示,填写服务器Remote名称,URL(git@git.yanwenbo.cn:root/tesproject.git),之前保存的本地私钥testkey.ppk,点击Add New/Save按钮保存这一设置,然后点击确定退出返回之前的对话框.

7.最终确认提交

8.push成功

9. Giblab后台查看提交结果.


大功告成...