Oct 28, 2014 - Multiple SSH Keys settings

主要是参考下面的两篇文章 注意操作顺序,一步一步来

①参考地址一

Generating SSH keys

②在项目的文件夹下设置git的config文件

config文件的目录在project_path/.git/config

修改前

1
2
3
[remote "origin"]
    url = git@github.com:kaogua/blog.git
    fetch = +refs/heads/*:refs/remotes/origin/*

修改后

1
2
3
[remote "origin"]
    url = git@kaogua.github.com:kaogua/blog.git
    fetch = +refs/heads/*:refs/remotes/origin/*

修改host,修改之后的host主要是为了后面的 .ssh/config,区分ssh key

③参考地址二

Multiple SSH Keys settings for different github account

修改之后的.ssh/config如下:

1
2
3
4
5
6
7
Host abc.github.com
    HostName github.com
    IdentityFile ~/.ssh/id_rsa_1

Host kaogua.github.com
    HostName github.com
    IdentityFile ~/.ssh/id_rsa_2

4 注意点

修改了.ssh/config文件之后,如果要clone的话,repository的host也需要变更,比如:

git@github.com:kaogua/blog.git ↘︎ git@kaogua.github.com:kaogua/blog.git

Oct 27, 2014 - 免费学习编程的9个地方

免费学习编程的9个地方

这个不是我写的文章,但是我觉得写得还可以 就收藏到了我的blog 想要看的同志请click下面的连接 原文

Oct 27, 2014 - Comparing two branches in GIT

Comparing two branches in GIT

1
git diff branch_1..branch_2

That will produce the diff between the tips of the two branches. If you'd prefer to find the diff from their common ancestor to test, you can use three dots instead of two.

1
git diff branch_1...branch_2