IntelliJ IDEA with Git 记住作者
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15566025/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
IntelliJ IDEA with Git remember author
提问by Andrei Fierbinteanu
I'm using IntelliJ with a Git project, and have setup my user.name
and user.email
properly. The problem is when committing using the IDE interface the author is not selected by default. I can click and I get a dropdown to select it, but sometimes I forget to do that, and it's a pain to ammend the commit each time I forget.
我使用的IntelliJ用Git项目,并有我的设置user.name
和user.email
正确。问题是在使用 IDE 界面提交时,默认情况下未选择作者。我可以点击并得到一个下拉列表来选择它,但有时我忘记这样做,每次我忘记修改提交时都很痛苦。
Is there a way to set the author automatically on commit, since it's only one, and it would save me some headaches?
有没有办法在提交时自动设置作者,因为它只有一个,它会为我省去一些麻烦?
回答by CrazyCoder
IntelliJ IDEA doesn't pre-select author in the combobox which is a known cosmetic issue, however it should use the author defined in the git configuration by default.
IntelliJ IDEA 不会在组合框中预先选择作者,这是一个已知的外观问题,但默认情况下它应该使用 git 配置中定义的作者。
Please double check that user.name
and user.email
is specified properly in the global git configuration.
请仔细检查user.name
并user.email
在全局 git 配置中正确指定。
Some users mentioned a problem when using cygwin git, when IDEA probably cannot find the global git config. In this case it may help if you specify the user for the local project configuration:
有用户在使用cygwin git时提到了一个问题,IDEA可能找不到全局git config。在这种情况下,如果您为本地项目配置指定用户可能会有所帮助:
git config --local user.name John
git config --local user.email [email protected]
回答by Dulith De Costa
Go to your project where git is initialized.
转到初始化git 的项目。
Then enable the hidden folders and find ".git
" and go inside the folder.
然后启用隐藏文件夹并找到“ .git
”并进入文件夹。
Find the file called "config
" and add below code and save.
找到名为“ config
”的文件并添加以下代码并保存。
[user]
name = username
email = [email protected]
Enter your correct username and email accordingly. This will be picked permanently and you do not need to change again.
相应地输入正确的用户名和电子邮件。这将被永久选中,您无需再次更改。