git diff
http://blog.csdn.net/wxqee/article/details/30464003
git config --global diff.tool vimdiff
git config --global difftool.prompt false
git config --global alias.d difftool
git创建分支
git checkout –b name
git branch --set-upstream my_branch origin/my_branch
远程分支本地分支关联
[root@localhost test]# git config --global user.name "yansiyu"
[root@localhost test]# git config --global user.email "yansiyu@shtest.com"
[root@localhost test]# git clone git@code.test.com:web_develop/test.git
Initialized empty Git repository in /home/test/test/.git/
ssh: Could not resolve hostname code.test.com: No address associated with hostname
fatal: The remote end hung up unexpectedly
[root@localhost test]# cat ~/.ssh/config
Host code.test.com
port 10020
[root@localhost test]# ping code.test.com
ping: unknown host code.test.com
[root@localhost test]# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 101.75.117.13
nameserver 101.96.209.5
[root@localhost test]# ping code.test.com
PING code.test.com (101.75.92.27) 56(84) bytes of data.
64 bytes from 101.75.92.27: icmp_seq=1 ttl=51 time=32.2 ms
--- code.test.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 6312ms
rtt min/avg/max/mdev = 32.235/32.235/32.235/0.000 ms
[root@localhost test]# git clone git@code.test.com:web_develop/test.git
Initialized empty Git repository in /home/test/test/.git/
The authenticity of host '[code.test.com]:10020 ([101.75.92.27]:10020)' can't be established.
RSA key fingerprint is 35:7b:85:f7:9a:03:b7:8c:8c:c2:29:57:b5:7e:6a:25.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[code.test.com]:10020,[101.75.92.27]:10020' (RSA) to the list of known hosts.
git@code.test.com's password:
[root@localhost test]#
#[root@localhost test]# ssh-keygen -t rsa -C "code.test.com"
[root@localhost test]# ssh-keygen #一对密钥对走天下
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
09:d3:2b:ce:b1:7c:86:af:d4:b9:6b:d6:26:83:06:e3 code.test.com
The key's randomart image is:
+--[ RSA 2048]----+
| |
| . |
| o . |
| o o |
| o S |
| o+ * . |
| . oB.=. |
| E.o+=.o |
| ..++= |
+-----------------+
[root@localhost test]# vim ~/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAwu7hwiarwDhjk5oPWf9+Kmzg7Bi5lj5baOJQJri5bTGZv+LG74mBo8ltl3uoc3dkmywC34MdQKuADWsaU0lU5kUi1fjeInLWBvJgr8G1dUtW23dEP28A6/flWW2hT8Wl87+dQKGPHkeBDwcaUkLmYHcfPscwyJNzfi2QIuhe3PtRhXvbCYE/ykmJE+kimDyqQ8bhd1O3pCw/Ka+wYKu8H91t+LpIM+DtueKPbA7iDB2cw8ves8eCjow5C3tcK1TFWobXecbaXWM78Nah6P5b+zTWFUxxAWFppHP/kKgmGfV1qFYCduMBacQzPPOfaaOsF0dRWZNVA+ILueL/+OwjWw== code.test.com
[root@localhost test]# ssh git@code.test.com
PTY allocation request failed on channel 0
Welcome to GitLab, yansiyu!
Connection to code.test.com closed.
[root@localhost test]# git clone git@code.test.com:web_develop/test.git
Initialized empty Git repository in /home/test/test/.git/
warning: You appear to have cloned an empty repository.
[root@localhost test]#
root@localhost test]# git config --list
user.name=yansiyu
user.email=yansiyu@shtest.com
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
remote.origin.url=git@code.test.com:web_develop/test.git
branch.master.remote=origin
branch.master.merge=refs/heads/master