git - 在许多帐户中使用不带 Sudo 的 Git

标签 git ubuntu sudo

如何在一个 Ubuntu 的多个帐户中不使用 Sudo 来使用 Git?

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

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

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

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

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

我运行 find 。 -iregex ".*index.l.* 不返回任何匹配项,因此在锁定系统时似乎没有 index.lock。我也使用 sudo 运行相同的命令但未成功。

最佳答案

如果我正确理解你的问题,你需要授予多个 *nix 用户帐户对同一个 git 存储库的写入权限。对 git init 使用 --share 命令行参数应该可以启用此功能。 GitWiki 有 a few words to say about this .这应该可以解决问题:

git --bare init --shared=all

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

git repo-config core.sharedRepository true

在您的存储库中,如 a blog post at moserei.de 中所述.

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

git config core.sharedRepository true

关于git - 在许多帐户中使用不带 Sudo 的 Git,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1367258/

相关文章:

windows - Vulkan 在 Linux 上找不到物理设备

python - 如何使用 python subprocess.check_output 和 root/sudo

android - repo :找不到命令?

opengl - GLFW - UBuntu 14.04 LTS 上的链接器错误

node.js - 当我提交时如何获取 git commit 消息?

ubuntu - Geoserver Proxy Base URL 不用于图层预览

ruby-on-rails-3 - rvmsudo : command not found

bash - 如何通过 sudo 命令使用 for 循环运行脚本

windows - SourceTree 自定义操作不起作用,但通过 Git 终端窗口起作用

git - 是否可以完全删除 Git 分支?