简体   繁体   English

git远程存储库和ssh协议

[英]git remote repository and ssh protocol

I have a git server and it has a user called git For remote clients, they use git@gitserver to clone, push and pull. 我有一个git服务器,它有一个名为git的用户。对于远程客户端,他们使用git @ gitserver进行克隆,推送和拉取。 For this to work, I need to give the password for user git. 为此,我需要提供用户git的密码。

Is there a better way of dealing with this? 有没有更好的方法来解决这个问题?

You can use ssh key for authentication. 您可以使用ssh密钥进行身份验证。 Each user make their own ssh key pair and then the public keys are collected inside ~/.ssh/authorized_keys of the git user. 每个用户创建自己的ssh密钥对,然后将公共密钥收集在git用户的~/.ssh/authorized_keys中。 After this is set up, users don't need to enter nor know the password of the git user. 设置完成后,用户无需输入也不知道git用户的密码。

Ideally you want each remote client/user to have his/her own login. 理想情况下,您希望每个远程客户端/用户都拥有自己的登录名。 You'll need each client to create a private key, generate a public key (using PuTTYgen or similar), and then add the public key to your authorized keys. 您将需要每个客户端创建一个私有密钥,生成一个公共密钥(使用PuTTYgen或类似的方法),然后将公共密钥添加到您的授权密钥中。

Here's a good place to start. 这是一个不错的起点。

They should use the ssh protocol . 他们应该使用ssh协议 The remote server needs to know each client's rsa key, and they won't need to enter the password for every remote action. 远程服务器需要知道每个客户端的rsa密钥,并且他们不需要为每个远程操作输入密码。

Two ways to solve this: 解决此问题的两种方法:

  1. Let them create RSA keys and upload the public key for the git user account. 让他们创建RSA密钥并上传git用户帐户的公共密钥。
  2. Install one of the open source applications designed for managing a private git server, such as Gitosis , Gitolite , or GitLab . 安装设计用于管理私有git服务器的开源应用程序之一,例如GitosisGitoliteGitLab

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM