Git 常用配置/ssh key pair 配置

1. 配置用户名

git config --global user.name "username"

2. 配置邮箱

git config --global user.email "xxxx@xxxx.xx"

3. 其他配置

# 让 Git 不要管 Windows/Unix 换行符转换的事
git config --global core.autocrlf false

4. 编码配置

# 避免 git gui 中的中文乱码
git config --global gui.encoding utf-8

# 避免 git status 显示的中文文件名乱码
git config --global core.quotepath off

# 让 git 对大小写敏感
git config --global core.ignorecase false

# 配置别名
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"

5. ssh key pair 配置

SSH 是建立在应用层和传输层基础上的安全协议,其目的是专为远程登录会话和其他网络服务提供安全性的保障。
SSH 密钥对可以让我们方便的登录到 SSH 服务器,而无需输入密码。

  1. Windows 上 Git Bash 命令行窗口中输入:ssh-keygen -t rsa -C “xxx@xxx.com”
  2. 接着一直回车生成 ssh key pair
  3. ssh-add ~/.ssh/id_rsa #把专用密钥添加到 ssh-agent 的高速缓存中,ssh-agent 能避免这种反复输入私钥的烦恼
  4. cat ~/.ssh/id_rsa.pub
    image.png
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值