如何使用 GIT 集成在 Intellij 14 中设置 user.email 和 user.name?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30677775/
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
How do i set user.email and user.name in Intellij 14 with GIT integration?
提问by maverick
I have IntelliJ 14 with GIT integrated. git push
command shows the Author as unknown
. How do I set the following two parameters in my IntelliJ IDE?
我有集成了 GIT 的 IntelliJ 14。git push
命令将作者显示为unknown
. 如何在 IntelliJ IDE 中设置以下两个参数?
git config --global user.name "Sam Smith"
git config --global user.email [email protected]
回答by Constantin Zagorsky
- Ctrl + Kto open commit dialog
- Type following pattern into "Git / Author:" dropdown field, replacing parts with personal data(keep space and angle brackets characters):
- Ctrl + K打开提交对话框
- 在“ Git / Author:”下拉字段中输入以下模式,用个人数据替换部分(保留空格和尖括号字符):
Name Surname <Email>
回答by Dulith De Costa
You can set the username and email for Intellij 14with GITintegration as follows. This worked for me.
您可以为Intellij 14与GIT集成设置用户名和电子邮件,如下所示。这对我有用。
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]
回答by Kami Wan
回答by Ardit ISAKU
Assuming that you have installed git from git-scm.com.
假设您已经从 git-scm.com 安装了 git。
For Linux or Mac OS use terminal.
对于 Linux 或 Mac OS,请使用终端。
For Windows environment: Use git bash (comes together with git installation) or use Powershell.
对于 Windows 环境:使用 git bash(与 git 安装一起提供)或使用 Powershell。
Run:
跑:
git config --global user.name "Sam Smith"
git config --global user.email [email protected]
Tricky part is: You have to commit at least one time from terminal.
棘手的部分是:您必须至少从终端提交一次。
git add my_awesome_file
git commit -m "My commit message"
VIOLA! Now your author is shown in IntelliJ commit panel.
薇奥拉!现在您的作者显示在 IntelliJ 提交面板中。
(Note: If you work with different repositories using different emails don't use global configuration)
(注意:如果您使用不同的电子邮件使用不同的存储库,请不要使用全局配置)
回答by David Deutsch
If I were you, I would just copy and paste those two lines in your command prompt; that will set the appropriate values, including for the IDE.
如果我是你,我会在你的命令提示符中复制并粘贴这两行;这将设置适当的值,包括 IDE。
If you really want to set it via the IDE for some reason, I would follow the instructions here.
如果您出于某种原因真的想通过 IDE 进行设置,我会按照此处的说明进行操作。