Git安装与配置

1. 下载 https://git-for-windows.github.io/

 

2. git基础配置

1. 配置用户名(提交时会引用)

git config --global user.name "xiaoxuan"

#请把xiaoxuan替换成自己的名字

2.配置邮箱(提交是会使用)

git config --global user.email "l_x_xuan@163.com"

#请把l_x_xuan@163.com替换为自己的邮箱

3.编码配置

git config --global gui.encoding utf-8

#避免git gui中的中文乱码

git config --global core.quotepath off

#避免git status显示的中文乱码

git config --global core.ignorecase  false

4.其它配置

git config --global merge.tool "kdiff3"

#要没有装KDiff3就不用设置这一行

git config --global core.autocrIf false

#让git不要管Windows/Unix换行符转换问题

 

2. git ssh key pair 配置

1. 在Git Bash命令窗口中键入:

ssh-keygen -t rsa -C "l_x_xuan@163.com"

2. 然后一路回车,不要输入任何密码之类,生产 ssh key pair

3. ssh-add ~/.ssh/id_rsa

4. cat~/.ssh/id_rsa.pub

注: 执行ssh-add时出现Could not open a connection to your authentication agent.

执行ssh-add ~/.ssh/rsa 报标题上的错误先执行 eval `ssh-agent` (是~键上的那个`)

再执行 ssh-add ~/.ssh/rsa成功ssh-add -I就有了新加的rsa了

5. 再把其中的公钥的内容复制到粘贴板上

6. 进入个人SSH公钥配置,把刚粘贴的复制添加进去,确定提交。

 

 

posted @ 2017-09-11 14:01  X_XUAN  阅读(663)  评论(0编辑  收藏  举报