是否可以在两台机器上使用相同的 ssh 私钥/公钥对来访问 git 存储库?

发布于 2024-07-28 23:22:10 字数 367 浏览 9 评论 0原文

我最近设置了一个内部 git 存储库服务器,并安装了 gitosis 作为管理工具,并将其启动并运行。 只读访问可通过 git:// 协议获得,写访问可通过使用 ssh 公钥的 gitosis 获得。

我有一位开发人员已被授予使用在其桌面工作站上生成的公钥访问其项目的权限。

他现在想要使用相同的 ssh 密钥对从他的笔记本电脑访问该存储库。 他将 .ssh 文件夹完整复制到他的笔记本电脑上,并尝试从存储库中克隆,但没有成功。

这是一个值得尝试的有效方法吗?

每台机器都需要生成 ssh 密钥对吗? 这看起来很奇怪,因为它实际上需要将每台机器的用户名添加到 gitosis 配置中。

任何帮助,将不胜感激。

I've recently setup an inhouse git repository server and have it up and running with gitosis installed as the management tool. Read only access is available via the git:// protocol and write access is available via gitosis using ssh public keys.

I have a developer that has been granted access to his projects with a public key that was generated on his desktop workstation.

He is now wanting to access that repository from his laptop using the same ssh key pair. He's copied has .ssh folder in it's entirety to his laptop and has tried to clone from the repository without success.

Is this a valid thing to try?

Does a ssh key pair need to be generated per machine? This seems weird as it would effectively require a per machine username to be added to the gitosis configuration.

Any help would be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

辞慾 2024-08-04 23:22:10

是的,我想你可以。

我有类似的东西。 两台机器,一台 Intel(台式机),另一台 Sparc。 我可以登录两台机器并使用 SSH 访问以及在 Intel 机器上生成的相同密钥对来访问同一 CVS 服务器(另一台机器)。

确保在复制私钥时正确设置 .ssh 目录的权限 (0700),并且主目录不能是组或全局可写的。
id_rsa 应该只有用户读取访问权限 (0400)

Yes I think you can.

I have something similar. Two machines, one Intel (desktop) the other one Sparc. I can log into both machines and access the same CVS server (another machine) using SSH access with the same key pair which was generated on the Intel machine.

Make sure when you copy across your private key that you set both the permissions of the .ssh directory correctly (0700) and your home directory cannot be group or world writable.
The id_rsa should only have user read access (0400)

哽咽笑 2024-08-04 23:22:10

是的,这是完全合法的。 ssh 密钥并不关心它们是在哪里生成的,并且可以将它们同时存在于多台计算机上。

尝试为 ssh 客户端提供“-v”或“-vv”选项(用于详细输出)并检查服务器的 ssh 日志以调试问题。

Yes, that's perfectly legitimate. ssh keys don't care where they were generated, and it's fine to have them on multiple machines at once.

Try giving the ssh client the "-v" or "-vv" option (for verbose output) and check the server's ssh log to debug the problem.

妄想挽回 2024-08-04 23:22:10

SSH 密钥对与计算机无关,这意味着您可以在一台计算机上创建 SSH 密钥对,并可以在多台计算机上部署相同的 SSH 密钥对。 这是正当的事情,你必须这样做。

此外,Git 使用 SSH 进行传输,因此您可以在具有相同 SSH 密钥对的两台计算机上克隆/下载 Git。

SSH key pair's are machine independent, which means you can create a SSH key pair on one machine and can deploy the same SSH key pair on multiple machines. It is valid thing to do, thats how you must do it.

Moreover Git uses SSH for transport, so you can clone/download the Git on both the machines having the same SSH key pair.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文