Git

Git的安装、配置

2017-02-10  本文已影响14人  JIUJIN九斤
>申请Github账号

http://jingyan.baidu.com/article/455a9950abe0ada167277864.html

>Mac本机上面安装Git

brew install git

>使用SSH把本机的Git连接网页版Github

1、家目录下是否存在.ssh文件夹,若没有的话创建一个

//这里的your_email@youremail.com指的是申请Github账号时候填写的邮箱```

 2、在本地生成一个SSH-KEY自动保存在id_rsa.pub文件中
```ssh-keygen -t rsa -C "your_email@youremail.com"```

这个过程中会有提示信息:
Enter passphrase(empty for no passphrase):
Enter same passphraseagain:
不用填写,直接按回车便可。

 3、在网页版的Github上新建SSH连接
Settings->SSH and GPG keys->new SSH key

    Title:随便填写
    Key:将id_rsa.pub文件copy到这里


![屏幕快照 2017-02-10 上午11.35.05.png](https://img.haomeiwen.com/i1832400/655a4bd3457b141c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

4、验证连接是否成功
 `ssh -T git@github.com`

    The authenticity of host 'github.com (207.97.227.239)' can't be established. 
    RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48. 
    Are you sure you want to continue connecting (yes/no)?    
    Hi username! You've successfully authenticated, but GitHub does not provide shell access.
出现如上信息便成功!

刚上面只能证明本机可以连接到Github,设置账号和密码磁能确保连接到具体的Github账户
#####>配置个人信息
`$git config --global user.name "your real name"`
 `$git config --global user.email "xxxxx@gmail.com"`
上一篇 下一篇

猜你喜欢

热点阅读