Table of Contents
1 设置用户
1.1 全局用户
1.1.1 设置姓名、邮箱
git config --global user.name "你的账号名称" git config --global user.email "你的邮箱"
1.1.2 生成 SSH key 文件
一路回车,使用默认值即可
ssh-keygen -t rsa -C "你的邮箱"
1.1.3 添加 key 到 github 账号上
1.1.4 连接测试
ssh -T git@github.com
- 成功提示
Hi 你的账号名称! You've successfully authenticated, but GitHub does not provide shell access.
- 连接出错
- Permission denied
- 错误提示(类似下面这样子的)
Permissions 0670 for 'home/12131.ssh/idrsa' are too open. It is recommended that your private key files are NOT accessible by others. This private key will be ignored. Load key "home/12131.ssh/idrsa": bad permissions Permission denied (publickey).
- 通过设置权限解决
chmod 755 ~/.ssh/ chmod 600 ~/.ssh/id_rsa ~/.ssh/id_rsa.pub chmod 644 ~/.ssh/known_hosts
- 错误提示(类似下面这样子的)
- Permission denied
Created: 2019-12-10 周二 16:22