Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

ubuntu - Using Git without Sudo in many accounts

How can you use Git without Sudo in multiple accounts in one Ubuntu?

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

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

I get the following message in trying to use Git

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

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

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

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

git config core.sharedRepository true

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...