动态更改 Git 用户

发布于 2024-11-17 07:25:09 字数 696 浏览 8 评论 0原文

我希望能够在 git 中切换名称和电子邮件,我尝试了以下操作:

alias setup_diffuser='export GIT_COMMITTER_NAME="Blah" && export GIT_COMMITTER_EMAIL="[email protected]" && export GIT_AUTHOR_NAME="Blah" && GIT_AUTHOR_EMAIL="[email protected]" && export BLAH="true"'

但是 git 提交中的名称是正确的,但电子邮件是 ~/.gitconfig 中的电子邮件而不是电子邮件在$GIT_AUTHOR_EMAIL中,如何在不编辑~/.gitconfig的情况下像上面那样动态设置电子邮件?我正在运行 git 版本 1.7.3.4

I'd like to be able to switch the name and email in git, I tried this:

alias setup_diffuser='export GIT_COMMITTER_NAME="Blah" && export GIT_COMMITTER_EMAIL="[email protected]" && export GIT_AUTHOR_NAME="Blah" && GIT_AUTHOR_EMAIL="[email protected]" && export BLAH="true"'

but the name in the git commit is correct but the email is the one in ~/.gitconfig not the email in$GIT_AUTHOR_EMAIL How can I set the email on the fly like above without editing the ~/.gitconfig? I'm running git version 1.7.3.4

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧故 2024-11-24 07:25:09

您忘记了 GIT_AUTHOR_EMAIL 的导出:

alias setup_diffuser='export GIT_COMMITTER_NAME="Blah" && export GIT_COMMITTER_EMAIL="[email protected]" && export GIT_AUTHOR_NAME="Blah" && export GIT_AUTHOR_EMAIL="[email protected]" && export blah="true"'

You forgot an export for GIT_AUTHOR_EMAIL :

alias setup_diffuser='export GIT_COMMITTER_NAME="Blah" && export GIT_COMMITTER_EMAIL="[email protected]" && export GIT_AUTHOR_NAME="Blah" && export GIT_AUTHOR_EMAIL="[email protected]" && export blah="true"'
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文