简体   繁体   English

如何设置magit commit author?

[英]how to set magit commit author?

i am using magit to do a git push, it fail with below error message: remote: ERROR: committer email address XXXX remote: ERROR: does not match your user account. 我正在使用magit进行git推送,它失败并显示以下错误消息:remote:ERROR:committer email address XXXX remote:ERROR:与您的用户帐户不匹配。

so i have to do this commit thru Git, why magit does not work? 所以我必须通过Git做这个,为什么magit不起作用?

"add a HOME enviroment varibales and specify the dir the same with the .gitconfig dir" sovleve this problem. “添加一个HOME环境变量和指定与.gitconfig目录相同的目录”可以解决这个问题。

it is because the magit can not find the .gitconfig file in the HOME dir. 这是因为magit无法在HOME目录中找到.gitconfig文件。

Use the above (or below) answer by @Björn Lindqvist with CAUTION. 请使用@BjörnLindqvist的上述(或以下)答案。 Do it ONLY if you know what you are going or it might ruin your environmental variables. 只有当你知道自己要去做什么或者它可能会破坏你的环境变量时才这样做。 Just a word of caution. 只是提醒一句。

Add this to .emacs to get it to work: 将其添加到.emacs以使其工作:

(when (string-equal system-type "windows-nt")
  (setenv "HOME" (concat (getenv "HOMEDRIVE") (getenv "HOMEPATH"))))

Much later... Don't use this code! 很久以后...... 不要使用这段代码! It will confuse Emacs and make it unable to locate the correct ~/.emacs file. 它会混淆Emacs并使其无法找到正确的~/.emacs文件。 The only right way is to set the HOME environment variable for the user. 唯一正确的方法是为用户设置HOME环境变量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM