首页 > 解决方案 > 别名(或其他方法)在远程shell上提交之前设置git ENV变量的命令?

问题描述

我有一个远程外壳,我和其他一些人正在使用它。我想对其进行设置,以便我可以运行类似gitcole ; git commit -m"example".

其中 gitcole 仅为该命令设置相关的环境变量,即:

GIT_AUTHOR_NAME is the human-readable name in the “author” field.

GIT_AUTHOR_EMAIL is the email for the “author” field.

GIT_COMMITTER_NAME sets the human name for the “committer” field.

GIT_COMMITTER_EMAIL is the email address for the “committer” field.

我对bash不是很熟悉。我将如何解决这个问题?

标签: bashgit

解决方案


所以我让它像这样工作:

在我的~/.gitconfig

[alias]
    cacm = -c user.name='colemars' -c user.email='MY_EMAIL' commit

然后你可以像这样使用它git cacm -m"commit message"

并为其他用户重复。

比我最初尝试制作的方式简单得多。


推荐阅读