简体   繁体   English

hg牵引多个用户

[英]hg pull with multiple users

I cloned a mercurial repository to a Ubuntu server to deploy the project there. 我将一个mercurial存储库克隆到Ubuntu服务器以在那里部署项目。 Everything works fine for me, but when a my colleague tried updating the server code with "hg pull" it uses my credentials for the pull. 一切都适合我,但当我的同事尝试使用“hg pull”更新服务器代码时,它使用我的凭据进行拉取。

What is the best way to enable multiple persons to update the server? 启用多人更新服务器的最佳方法是什么? The only way I can think of right now is to create a common user in the repository for which both of us know the password. 我现在能想到的唯一方法是在存储库中创建一个公共用户,我们都知道密码。

On the server we both have our own user accounts that belong to the same group. 在服务器上,我们都拥有属于同一组的自己的用户帐户。

Edit: I figured that I can also specify the url so: "hg pull https://user@server.com/project " works, but this is still a bit tedious 编辑:我想我也可以指定网址:“hg pull https://user@server.com/project ”有效,但这仍然有点乏味

You should indeed create on the repository server a user for common usage which is granted access to that repository. 您确实应该在存储库服务器上创建一个用户,以便获得对该存储库的访问权限。 Preferentially you also allow ssh access via key to the repository via key from the server where you deployed the project. 优选地,您还允许通过来自部署项目的服务器的密钥通过密钥访问存储库。 That way the user on the deployment server can pull from the repository server without any passwords 这样,部署服务器上的用户可以从存储库服务器中提取而无需任何密码

You can restrict the ssh access on the repository server for that user by installing hg-ssh and editing its .ssh/authorized_keys file approriately: 您可以通过安装hg-ssh并适当地编辑其.ssh / authorized_keys文件来限制该用户的存储库服务器上的ssh访问:

command="/home/repository-user/bin/hg-ssh * hg-repos/*",no-port-forwarding,no-X11-forwarding,no-agent-forwarding ssh-rsa AAAAB3Nz...aS8JqGh4Q== someone@example.com (Max Mustermann) command =“/ home / repository-user / bin / hg-ssh * hg-repos / *”,no-port-forwarding,no-X11-forwarding,no-agent-forwarding ssh-rsa AAAAB3Nz ... aS8JqGh4Q == someone@example.com(Max Mustermann)

You can that way easily allow other people or servers access to that repository: simply let them generate a key pair, too. 您可以通过这种方式轻松地允许其他人或服务器访问该存储库:只需让它们生成密钥对。 And install their public key in the authorized_keys file of the (shared) repository user on the repository server. 并将其公钥安装在存储库服务器上(共享)存储库用户的authorized_keys文件中。 Simply restrict all the remote users from using any shell by restricting the allowed ssh commands to hg-ssh as shown above. 通过将允许的ssh命令限制为hg-ssh,简单地限制所有远程用户使用任何shell,如上所示。

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

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