[英]How do you use Git with multiple users on same machine?
We all know you can set Git email and username in git.config
. 我们都知道你可以在git.config
设置Git电子邮件和用户名。
What's the best approach when two users use the same machine? 当两个用户使用同一台机器时,最好的方法是什么?
如果您有兴趣在提交时添加用户信息,则可以在每次提交时设置作者。
git commit -m "some message" --author "user2@email.com"
The sequence of actions: 行动顺序:
git init --shared
用git init --shared
chown -R :<the_group> .
运行chown -R :<the_group> .
inside the repo. 回购里面。 git clone /path/to/the/repo
from within their home folders) and work each in their private repo clones with their own personal settings, including name and e-mail. 现在,您的用户可以克隆repo( git clone /path/to/the/repo
从他们的主文件夹中),并使用他们自己的个人设置(包括姓名和电子邮件)在私人repo克隆中进行处理。 They need to publish their work periodically with git push
. 他们需要定期用git push
发布他们的工作。 如果没有单独的用户帐户,我会编写一个GIT_AUTHOR_***
设置这些GIT_AUTHOR_***
环境变量: https : GIT_AUTHOR_***
#Committing
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.