同一台机器上的多个Git用户 [英] Multiple Git Users On Same Machine

查看:82
本文介绍了同一台机器上的多个Git用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的团队共享一台MacBook,所有人不时使用它,并且每个人都有一个帐户,因此我们都处于登录状态.要提交代码更改,我们使用SmartGitHg 4.5(当前安装的Git版本为1.8.3.2).由于这些提交可能会有些混乱,因此我正在寻找一种设置/配置解决方案,以正确的名称进行提交,因为如果我将Git全局配置中的userdata保留为空,则会自动以'developer'的名称进行提交(这是我们计算机的帐户名称),即使在提交/推送时总是会要求我提供凭据.

Our team shares a MacBook which everybody uses from time to time with one account on it, so we're all on the some login. To commit our code changes we're using SmartGitHg 4.5 (current Git version installed is 1.8.3.2). Since these commits can get a little messy, I'm looking for a setup/config solution to commit under the right name, because if I leave the userdata in Git's global config empty, I'm automatically committing under the name 'developer' (which is the account name of our machine) even though I'm always getting asked for credentials when committing/pushing.

因此,也许有人对如何设置它有一个好主意,以便在提交/推动/拉动时只需输入凭据即可.也许使用OSX钥匙串是一种方法?

So maybe someone has a good idea how to set this up so that one just has to put in the credentials when committing/pushing/pulling. Maybe using the OSX keychain could be a way?

推荐答案

如果没有足够的磁盘空间用于单独的克隆,则可以尝试以下操作:

If you don't have enough disk space for separate clones, you can try the following:

使用不同的登录名,并编写一个脚本来更改登录名和电子邮件.

Use differente logins and write a script that changes the username and email on login.

或(如果您真的只想使用一个帐户)

OR (if you really want to use one account only)

编写一个脚本,该脚本在每次登录后询问用户名和电子邮件.这样,没人会忘记更改用户名和电子邮件.

Write a script that asks after every login for the username and email. That way nobody can forget to change the username and email.

这篇关于同一台机器上的多个Git用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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