git ssh-key
2024-01-01 / 崔兰鑫
配置git ssh
配置git ssh
1. 下载git
$ sudo apt install git
2. 设置git config
$ git config --global user.name "xxx"
$ git config --global user.email "xxx@.com"
3. 生成key
- 回车到底
$ ssh-keygen -t rsa -C "xxx@.com"
4. 复制生成的 ssh-rsa,pub
- 复制输出内容
$ cat ~/.ssh/id_rsa.pub
5. 配置到git
- Setting-》SSH and GPG keys -》SSh keys
- title 随便写
- ssh 就是刚才复制的 id_rsa.pub 内容
6. 问题
- 没有权限
- 检查email name 是否正确
- 查看是否配置成功
$ ssh -T git@github.com
# Hi user.name! You've successfully authenticated, but GitHub does # not provide shell access.
- 如果没有配置成功尝试一下
ssh-add命令是把专用密钥添加到ssh-agent的高速缓存中,从而提高ssh的认证速度
$ ssh-add ~/.ssh/id_rsa
本文链接:
https://cuilanxin.github.io/2024/01/01/configure/git ssh/