在许多帐户中使用没有 Sudo 的 Git [英] Using Git without Sudo in many accounts

查看:31
本文介绍了在许多帐户中使用没有 Sudo 的 Git的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个 Ubuntu 中,如何在没有 Sudo 的情况下在多个帐户中使用 Git?

我的 Ubuntu 有很多帐户.新帐户的创建使我在没有 sudo 的情况下无法访问 Git.

My Ubuntu has many accounts. The creation of new accounts has made Git inaccessible by me without sudo.

我将所有者更改为 me,masi,将组更改为 adminmasi 所属的组.我对 Git 有以下权限

I changed the owner to be me, masi, and the group to be admin where the masi belongs to. I have the following permissions for Git

800 -rwxrwxrwx 1 masi admin 813744 2009-02-20 23:01 /usr/bin/git

我在尝试使用 Git 时收到以下消息

I get the following message in trying to use Git

git status
fatal: unable to create '.git/index.lock': Permission denied

我运行 find .-iregex ".*index.l.* 不返回匹配项,因此锁定系统时似乎没有 index.lock.我也使用 sudo 运行相同的命令失败.

I run find . -iregex ".*index.l.* which returns no matches so there seems to be no index.lock in locking the system. I run the same command also with sudo unsuccessfully.

推荐答案

如果我正确理解您的问题,您需要授予多个 *nix 用户帐户对同一个 git 存储库的写入权限.使用 --share 命令行参数 git init 应该可以启用此功能.GitWiki 有关于这个要说几句话.这应该可以解决问题:

If I understand your question correctly, you need grant several *nix user accounts write access to the same git repository. Using the --share command line argument for git init should enable this. The GitWiki has a few words to say about this. This should do the trick:

git --bare init --shared=all

如果您已经创建了您的存储库,您可以通过抛出以下命令将其转换为共享存储库":

If you have already created your repository, you might be able to convert it to a "shared repository" by throwing this command:

git repo-config core.sharedRepository true

在您的存储库中,如 moserei.de 上的一篇博文.

in your repository, as mentioned in a blog post at moserei.de.

2014 年更新:这仍然是可能的,但命令已从 repo-config 更改为 config.

2014 update: This is still possible but the command has changed from repo-config to config.

git config core.sharedRepository true

这篇关于在许多帐户中使用没有 Sudo 的 Git的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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