git + assembla +多个ssh密钥/多台计算机 [英] git + assembla + multiple ssh keys/multiple computers

查看:231
本文介绍了git + assembla +多个ssh密钥/多台计算机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有多台计算机在同一个项目上工作,我使用免费的组合账户来管理所有这些。

为了访问git仓库,我需要在每台计算机上生成唯一的SSH密钥。
然而,一台计算机也可能在其他组合项目上工作,所以每当我生成一个新的ssh密钥时(如我必须不断更换id_rsa文件),似乎会有冲突。
一旦我在本地机器上重新创建id_rsa文件(并替换它们),它就会失去使用先前生成的ssh密钥访问之前的组合项目的权限。



我发现了一些听起来像是我的问题的解决方案:
针对不同项目的不同SSH密钥
http://www.assembla .com / spaces / breakoutdocs / wiki / Different_SSH_keys_for_different_projects



然而,我不明白如何去做#1?它说放置在$ PATH这个脚本的某处(让它的名字是gitssh),但我不知道$ PATH是什么/哪里?



任何帮助将不胜感激。
Thanks !!

解决方案

您可以创建任意数量的公钥/私钥ssh密钥。

不要使用默认名称 id_rsa id_rsa.pub



但是,不使用默认命名约定意味着ssh默认情况下不会找到您的密钥。

您需要在〜/ .ssh 目录一个配置文件,您将在其中指明要使用的私钥:

 主机myproject1 
HostName server1
IdentityFile〜/ .ssh / project1.rsa
用户名

如果已将 myproject1 添加为远程文件,则可以推送至 myproject1

另请参阅无法将主人推送到Github 进行ssh疑难解答,并且不使用〜/ .ssh / config 为git push指定SSH密钥用于将您的ssh地址添加为远程。



您可以添加到〜/ .ssh / config 文件尽可能多的地址,每一个引用一个私人密钥,你可以任意命名。


I have multiple computers working on the same project, and I'm using a free assembla git repo account to manage all this.

In order to access the git repo, I need to generate unique SSH keys on each computer. However, a computer might be working on other assembla projects as well, so there seems to be a conflict whenever I generate a new ssh key (like I have to keep replacing the id_rsa files). Once I recreate the id_rsa files (and replace them) on a local machine, it loses access to the previous assembla git projects using the previously-generated ssh key.

I'm fairly new to the whole git business, and trying to learn as I go.

I found something that sounded like a solution to my problem: "Different SSH keys for different projects" http://www.assembla.com/spaces/breakoutdocs/wiki/Different_SSH_keys_for_different_projects

However, I don't understand how to do #1? It says to "place somewhere in $PATH this script (let its name will be gitssh)", but I don't know what/where "$PATH" is?

Any help would be greatly appreciated. Thanks!!

解决方案

You can create as many public/private ssh key as you want.
Simply don't use the default names id_rsa and id_rsa.pub.

However, not using the default naming convention means ssh, by default, won't find your keys.
You need to define in your ~/.ssh directory a config file, where you will indicate what private key to use:

Host myproject1
    HostName server1
    IdentityFile ~/.ssh/project1.rsa
    User username

You can then push to myproject1 if you have added myproject1 as a remote.
See also "Unable to Git-push master to Github" for ssh troubleshooting, and "Specify an SSH key for git push without using ~/.ssh/config" for adding your ssh address as a remote.

You can add to the ~/.ssh/config file as many address as you need, each one referring a private key that you can name as you want.

这篇关于git + assembla +多个ssh密钥/多台计算机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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