Introduction

First of all, let me clarify that Git doesn’t need to specify the side for client and server. Your workstation can be both the client and server. That means you can get code from other computer, you’re the client; while others can also get code from your computer, you’re the server. That’s why Git is great.

In this post, the “Git server” means to make your computer available for others to pull/push code from/to.

The post is long because it’s step by step and with lots of screenshots. In fact, it just takes about 10 minutes to setup all.

Note: CopSSH is not open source any more, please buy it if you want to use it.

Software Requirement

Software required to setup a Git server:

  • CopSSH (install on the server side)

  • msysgit (install both on the server side and client side)

  • PuTTY (install both on the server side and client side)

Software required to integrate with Visual Studio:

  • GitExtensions (install both on the server side and client side)

Setup Steps

1. Install msysgit

  1. When you installing the msysgit, please choose c:\Git as the installation directory, because the space in the directory name may cause an issue in bash commands.

In the “Adjusting your PATH environment”, I recommend to select “Use Git Bash only”.

Other settings are default. After installation, you get the git bash icons on your desktop. You can try it with git command, if you get the following screen, you’ve installed the msysgit successfully.

Add C:\Git\bin and C:\Git\libexec\git-core to Path. This step is very important.

2. Install CopSSH

  1. Just like the msysgit, we don’t install the CopSSH in program files folder to avoid some space issues. We install it to c:\ICW.

2. Install CopSSH

  1. Just like the msysgit, we don’t install the CopSSH in program files folder to avoid some space issues. We install it to c:\ICW.

  2. Just use the default account as CopSSH provides:

  3. After installation, open COPSSH Control Panel.

  4. Click Add button in Users tab.

  5. Choose an existing user on your computer (you can create one in computer management). Here in my sample, the user is jinweijie.

  6. Allow all access:

  7. After the user is activated, click the Keys… button in the Activated Users section:

  8. Click Add:

  9. Use default key settings:

  10. Enter the Passphrase and File name:

  11. The private key will be saved to c:\ICW\home\jinweijie\ryan-vm-01_2048.ppk.

[Test step] Now we try to use the activated user to log on through SSH, open Git Bash, enter commands:

Collapse | Copy Code
ssh jinweijie@ryan-vm-01

Enter “yes” to continue.

[Test step] After entering your passwords (the windows account’s password), then you try to run git as the ssh user, but it isn’t performed as you expected:

That’s because CopSSH cannot find the git.exe on the server, so we need to tell CopSSH the git path.

3. Config CopSSH with Git path.

  1. Open C:\ICW\etc\profile with your favorite editor, add :/cygdrive/c/git/bin:/cygdrive/c/git/libexec/git-core(don’t forget the starting colon) to PATH , the whole line will be:

    Collapse | Copy Code
    export PATH="/bin:$syspath:$winpath:/cygdrive/c/git/bin:/cygdrive/c/git/libexec/git-core" 

    Then Save.

  2. Restart the CopSSH by clicking twice the big button in CopSSH Control Panel:

  3. If we run Git Bash again, ssh jinweijie@ryan-vm-01, enter your password and run the git command, git should be found this time:

4. Configure Private Key on Client

  1. Copy the private key (we generated in step 1-k) from server to client.

  2. On the client side, use puttygen.exe to load the key (if you set the password in 1-j, you need to enter the password while loading the key):

  3. Click “Save private key” to save a copy of private key for plink.exe to recognize.

5. Create Repository, Integrate with Visual Studio

  1. Install gitextensions on both server and client.

  2. Since we have already installed the msysgit in step 1-a, we skip the “Install MsysGit”. But if you haven’t install msysgit on the client machine, you can check the checkbox and install it.

  3. Install to C:\GitExtensions\, other settings are default.

  4. On the server side, open Git Extensions, click “Create new repository”.

  5. On the server side, set the path to the project name under you CopSSH user’s home directory, select“Central repository, no working dir” (because we are the server), then “Initialize”:

  6. On the client side, open Git Extensions, click “Clone repository”:

  7. On the client side, the repository address should be ssh://jinweijie@ryan-vm-01/ICW/home/jinweijie/mydotnetproject. Please be aware that, the repository should begin with c:\ on the server.

  8. On the client side, click “Load SSH Key” and load the key which was saved in step 4-b:

  9. On the client side, enter the password if you set password to the key, then click Clone:

  10. On the client side, add ignore files:

  11. On the client side, open Visual Studio, create a project to mydotnetproject folder (which is the cloned repository), you may find the files are already under git source control:

  12. Click the “Commit” button on the menu bar, then click “Commit & Push”:

  13. Push succeeded:

  14. On the server side, you can find the new pushed files:

That’s all, happy GITTING! :)

参考:

http://www.codeproject.com/Articles/296398/Step-by-Step-Setup-Git-Server-on-Windows-with-CopS

https://code.google.com/p/gitextensions/downloads/list

http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

https://code.google.com/p/msysgit/downloads/detail?name=msysGit-fullinstall-1.8.4-preview20130916.exe&can=2&q=

https://www.itefix.no/i2/content/copssh-free-edition

http://wenku.baidu.com/view/f421c5ebe009581b6bd9eb6d.html

http://www.cnblogs.com/kysnail/archive/2012/03/16/2399589.html

http://www.weste.net/2013/1-31/88703.html

http://www.weste.net/2013/1-31/88703.html

http://book.51cto.com/art/201107/278854.htm

http://www.lifeba.org/arch/git_gitosis.html

http://blog.sina.com.cn/s/blog_67a3453d0101j8qr.html

转载于:https://blog.51cto.com/mypan/1314892

Step by Step Setup Git Server on Windows with CopSSH + msysGit and Integrate Git with Visual Studio相关推荐

  1. Windows下安装 msysGit 以及初始化 Git server环境

    Windows下git工具msysGit使用以及Git server初始化 Windows下git工具,这里选择msysGit,版本为msysGit-netinstall-1.8.1.2-previe ...

  2. BUG: Setup Was Unable to Create a DCOM User Account Error Message in Visual Studio 6.0

    今天在安装VS 6.0时,遇见这个问题:Setup was unable to create a DCOM user account in order to register <path> ...

  3. Mikrotik: Setup SSTP Server for Windows 10 Client

    原文: http://www.dr0u.com/mikrotik-setup-sstp-server-for-windows-10-client/ Basic how-to on SSTP for a ...

  4. Visual C# 2008+SQL Server 2005 数据库与网络开发-- 1.1 Visual Studio 2008概述

    本节首先介绍了.NET的开发环境和安装配置,重点介绍了Visual Studio 2008新增的主要控件和MSDN. 转载于:https://www.cnblogs.com/008aspnet/arc ...

  5. 在Windows上搭建Git Server

    Git在版本控制方面,相比与SVN有更多的灵活性,对于开源的项目,我们可以托管到Github上面,非常方便,但是闭源的项目就会收取昂贵的费用. 那么私有项目,如何用Git进行代码版本控制呢?我们可以自 ...

  6. Windows系统搭建GitServer--Bonobo Git Server

    一.关于Bonobo Git Server Bonobo Git Server 是一套基于 asp.net 的 git 服务器.运行于 Windows IIS 上. 把它解压缩出来放到一个目录下,按照 ...

  7. Windows 底下安装 git Server: Bonobo Git Server

    Bonobo Git Server 是一套基于 asp.net 的 git 服务器.运行于 Windows IIS 上. 把它解压缩出来放到一个目录下,设置注意几点: 1. 该目录让 IIS_User ...

  8. 自建具备全文搜索能力的git server

    自建具备全文搜索能力的git server 文章目录 自建具备全文搜索能力的git server 需求 分析 模块图 实现 githook gitmonitor gitclient gitadd 需求 ...

  9. 在群晖NAS上搭建 Git Server

    概述 事前准备 配置NAS 1 在群晖NAS上安装 Git Server 套件 2 创建用来存放git仓库的共享目录 3 创建用来使用git的普通用户 4 设置 Git Server 允许刚创建的用户 ...

最新文章

  1. NETGEAR拒绝连接请求_3分钟理解HTTP的请求与响应
  2. 有了“手掌”,机械手也能盘“核桃”,耶鲁出品 | Science子刊
  3. linux 禁用 ctrl+alt+del 重启系统
  4. Redis缓存数据库(一)
  5. 这 12 款 IDEA 插件你用过几款?
  6. 【算法知识】详解快速排序算法
  7. Python 依赖库
  8. 使用JDK 13查看TLS配置
  9. 递归-裴波那契数列(代码、分析、汇编)
  10. java监听器原理_java监听器原理
  11. NuGet是什么?理解与使用(下)
  12. 深入理解java虚拟机JVM(上)
  13. 二进制十六进制相互转换
  14. 什么样性格的人最有可能成为领导者?
  15. 自己动手修改VB.NET支付宝接口
  16. 厦门理工学院计算机毕业要求,计算机教学中心-厦门理工学院教务处.PDF
  17. 联想服务器如何u盘安装系统教程,u盘联想系统安装教程 联想如何启动u盘安装系统教程...
  18. 大天使黎明服务器维护,37大天使之剑3月5日部分区服维护公告
  19. 【数据结构之二叉树】——二叉树的概念及结构,特殊的二叉树和二叉树性质
  20. 无线服务器怎么开启,无线wifi路由器关了怎么开启

热门文章

  1. 海龟交易代码java_海龟交易算法,实现量化交易(1)数据获取
  2. 你的 A/B 测试数据期骗你了吗?
  3. 如何在Cordova Android 7.0.0 以下版本集成最新插件 极光插件为例 1
  4. js进阶 9-14 js如何实现下拉列表多选移除
  5. JavaScript实现冒泡排序 可视化
  6. javascript 对象方法、类方法、原型方法
  7. 高度平衡树 -- AVL 树
  8. [javaSE] 多线程(join方法)
  9. CSS学习笔记(十四) 我们前端是怎么跟设计师沟通的
  10. JAVA基础知识(4)