1 用gitlab来创建内部使用的版本控制

windows可以用git , 但是sourcetree用起来更方便,更强大

用gitLab和sourcetree来管理版本控制_gitlab sourcetree



下面是环境的设置

2.创建 SSH 秘钥

在你的电脑与 GitCafe 服务器之间保持通信时,我们使用 SSH key 认证方式来保证通信安全,所以在使用 GitCafe 前你必须先建创自已的 SSH key。
1). 进入 SSH 目录
cd ~/.ssh
#如果还没有 ~/.ssh 目录的话,请先手工创建一个 mkdir ~/.ssh 。
2). 生成新的 SSH 秘钥 (记得把以下命令中的 your_email@youremail.com 改为你的 Email 地址 )
ssh-keygen -t rsa -C "your_email@youremail.com" -f ~/.ssh/gitcafe
3). 生成过程中会出现以下信息,按屏幕提示操作,并记得输入 passphrase 口令。
$ ssh-keygen -t rsa -C "your_email@youremail.com" -f ~/.ssh/gitcafe
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/username/.ssh/gitcafe.
Your public key has been saved in /c/Users/username/.ssh/gitcafe.pub.
The key fingerprint is:
15:81:d2:7a:c6:6c:0f:ec:b0:b6:d4:18:b8:d1:41:48 your_email@youremail.com
4). SSH 秘钥生成结束后,你可以在用户目录 (~/.ssh/) 下看到私钥 gitcafe 和公钥 gitcafe.pub 这两个文件,**记住千万不要把私钥文件 gitcafe 透露给任何人。**
5). 在 SSH 用户配置文件 ~/.ssh/config 中指定证书名称,如果没有 config 文件的话就新建一个 (Linux 平台的话需使用该命令 chmod 644 ~/.ssh/config 来改变 config 文件权限),并输入以下内容:
Host gitcafe.com www.gitcafe.com
    IdentityFile ~/.ssh/gitcafe

3.添加 SSH 公钥到 Gitlab

1). 用文本工具打开公钥文件 ~/.ssh/gitcafe.pub ,复制里面的所有内容到剪贴板。
2). 进入 Gitlab -->账户设置-->SSH 公钥管理设置项,点击添加新公钥 按钮,在 Title 文本框中输入任意字符,在 Key 文本框粘贴刚才复制的公钥字符串,按保存按钮完成操作。
用gitLab和sourcetree来管理版本控制_gitlab sourcetree_02
上面是用gitcafe做的例子,实际差不多

4 打开sourcetree,新增Repository

source path/url:填写gitlab里面给你生成目录的地址

第二项写自己的目录,ok, 创建完成

5  打开Repository