GIT和SSH,使用哪个密钥? [英] GIT and SSH, which key is used?

查看:88
本文介绍了GIT和SSH,使用哪个密钥?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设您的 .ssh 目录包含30个键(15个私人和15个公开)



c $ c> GIT ,可以检查哪一个用于连接到给定的远程repo?

解决方案

.ssh / config 文件中的以下条目解决了该问题

  host git.assembla.com 
user git
identityfile〜/ .ssh / whatever

其中〜/ .ssh / whatever 是您的私钥的路径

主机可以从

  git push git@git.assembla.com:repo_name.git 
^ __ ^ _______________
用户主机


Say your .ssh directory contains 30 keys (15 private and 15 public)

Where in GIT, can one check which one is used to connect to a given remote repo?

解决方案

The following entry in .ssh/config file solves the problem

  host git.assembla.com
  user git
  identityfile ~/.ssh/whatever

Where ~/.ssh/whatever is a path to your private key

Additionally, user and host can be picked up from

git push git@git.assembla.com:repo_name.git
         ^__ ^_______________
         user host

这篇关于GIT和SSH,使用哪个密钥?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆