git_share

linux 环境(192.168.8.58)

 

1. 生成rsa key

         $ ssh-keygen

         如果你之前没有跑过这个文件, 接受默认选项即可。

         这样你会在 ~/.ssh/下看到 id_rsa和id_rsa.pub

1.1 将id_rsa.pub的内容添加到 http://192.168.21.108:82/profile/keys中

         注意由于id_rsa.pub文件较长, 可能打印成多行, 其实是一行。

2. 生成~/.ssh/config文件

3. 修改~/.ssh/config文件的权限为只能自己读写

         $ chmod 600 ~/.ssh/config

4. 在~/.ssh/config中加入以下内容

         Host gitlab

       HostName 192.168.21.108

       User git

       Port 32

       PubkeyAuthentication yes

       RSAAuthentication yes

       IdentityFile ~/.ssh/id_rsa

5. 告诉git你是谁。

    git 是分布式管理系统, 没有一个统一的机构管理你的id, 你得自己告诉它

    $ git config --global user.name wei.jia

    $ git config --global user.email wei.jia@adchina.com

6. 让git给你点颜色看看, 否则看diff, status太累

    $ git config --global color.ui true

    $ git config --global color.status true

7. 在你的工作目录下执行:

    git clone ssh://git@gitlab:32/data-team/sealion.git

8. 到sealion下工作

         $ cd sealion

 

windows环境

1. 安装git

         https://github.com/msysgit/msysgit/releases/download/Git-1.9.5-preview20141217/Git-1.9.5-preview20141217.exe

         \\f\PD\Develop Tools\Git-1.9.5-preview20141217.exe

2. 启动git bash

3. 生成rsa key

         $ ssh-keygen

         接受所有默认选项即可

4. 将id_rsa.pub添加到http://192.168.21.108:82/profile/keys中

         a. 用notepad打开刚创建的id_rsa.pub, Ctrl-A 选择全部, Ctrl-C复制

         b. 在网页上点击 "Add SSH Key"

         c. 将复制内容粘贴到key中, 然后点击“Add Key”

 

5. 在~/.ssh/config中加入以下内容, 如果这个文件不存在,请使用vim或notepad创建一个

         Host gitlab

       HostName 192.168.21.108

       User git

       Port 32

       PubkeyAuthentication yes

       RSAAuthentication yes

       IdentityFile ~/.ssh/id_rsa

6. 告诉git你是谁。

    git 是分布式管理系统, 没有一个统一的机构管理你的id, 你得自己告诉它

         记得将命令中的贾玮的信息改成你的!!

    $ git config --global user.name wei.jia

    $ git config --global user.email wei.jia@adchina.com

7. 让git给你点颜色看看, 否则看diff, status太累

    $ git config --global color.ui true

    $ git config --global color.status true

8. 设置git bash到你的工作目录

         8.1 在git bash下执行 $ cd /path/to/workdir/

         8.2 或在/path/to/workdir 下执行右击 git bash

9.  git clone ssh://git@gitlab:32/data-team/sealion.git

posted @ 2015-02-15 11:32  doo  阅读(316)  评论(0编辑  收藏  举报