多个用户使用相同的git存储库 [英] Using same git repository by multiple users

查看:213
本文介绍了多个用户使用相同的git存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知,只有一个用户的身份可以用git config指定。我有一种情况,我想为同一个git存储库拥有多个身份,这取决于UNIX用户。



存储库位于/ var / www。当用户插孔进行提交时,提交应该自动成为插孔的标识。当用户jill进行提交时,应该使用jill的身份。



我之所以要使用同一个存储库的原因是因为它是网站的内容,Apache是在/ var / www中查找。内容不是用户特定的,所以使用Apache的userdir功能在这里不是一个选项。

解决方案

每个UNIX用户都有自己的
因此,每个UNIX用户都可以拥有它自己的git配置文件(〜/ .gitconfig)。
然后,每个UNIX用户都可以使用它的共享存储库进行提交自己的身份。

As far as I know, only a single user's identity may be specified with git config. I have a situation where I'd like to have multiple identities for the same git repository, depending on the UNIX user.

The repository is at /var/www. When user jack makes a commit to it, the commit should automatically be jack's identity. When user jill makes a commit, jill's identity should be used.

The reason why I want to use the same repository is because it's the content of a website, and Apache is looking in /var/www. The contents are NOT user-specific, so using Apache's userdir feature is not an option here.

解决方案

Every UNIX user has it's own home directory.
Therefore, every UNIX user can has it's own git config file (~/.gitconfig).
Then, every UNIX user can commit on shared repository with it's own identity.

这篇关于多个用户使用相同的git存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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