Aspire

git 使用 ssh

发布时间:4年前热度: 4350 ℃评论数:

1:生成
按照提示完成三次回车
ssh-keygen -t rsa -C 'xxx@xxx.xxx' -f ~/.ssh/gitee_id_rsa


2.创建 SSH 用户配置文件 config

touch ~/.ssh/config

添加以下内容

# github

Host github.com

HostName github.com

PreferredAuthentications publickey

IdentityFile ~/.ssh/github_id_rsa

# IdentityFile /var/root/.ssh/github_id_rsa

# gitee

Host gitee.com

HostName gitee.com

PreferredAuthentications publickey

IdentityFile ~/.ssh/gitee_id_rsa

# IdentityFile /var/root/.ssh/gitee_id_rsa


Host 和 HostName 填写 git 服务器的域名
IdentityFile 指定私钥的路径



3.测试

ssh -T git@github.com

记得私钥文件权限要为600


源码安装、技术讨论、二次开发等联系微信:

git 使用 ssh

栏目导航

  1. PHP
  2. Go
  3. Mysql
  4. Linux
  5. 前端
  6. 杂谈

相关文章

  1. 增强bash命令 4364 ℃
  2. git 使用 ssh 4350 ℃
  3. 安装 supervisor 3954 ℃
  4. 性能常用命令 3936 ℃
  5. 文件权限 3620 ℃
  6. rsync 命令 3337 ℃
  7. centos文件共享 3269 ℃
  8. shell解析腾讯云 3239 ℃
  9. crontab使用 3231 ℃
  10. linux zip,tar命令 3155 ℃

手机扫码访问