Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git提交的问题_Git - Fatal编程技术网

Git提交的问题

Git提交的问题,git,Git,当我推迟到git commit时,我最终得到了以下答案: ***Please tell me who you are. Run: git config --global user.email "you@example.com" git config --global user.name "Your name" Omit --global to set the name only in this repository. fatal: unable to auto-detect ema

当我推迟到
git commit
时,我最终得到了以下答案:

***Please tell me who you are.
Run:
   git config --global user.email "you@example.com"
   git config --global user.name "Your name"

Omit --global to set the name only in this repository.
fatal: unable to auto-detect email address (Got username@computername.<none>)
请告诉我你是谁。 运行: git config--global user.email“you@example.com" git config--global user.name“Your name” ommit--global仅在此存储库中设置名称。 致命:无法自动检测电子邮件地址(Got)username@computername.)
但是当我运行上面的任一选项,然后运行
git commit
时,我仍然会得到上面的消息。我只是从
cmd.exe
用普通的
git commit
运行它们。我的操作系统是WindowsVista。另外,我的
.gitconfig
位于
C:\Users\\\.gitconfig

中。如果您的
.gitconfig
文件位于受用户访问控制(UAC)保护的目录中,则您可能需要以提升权限(管理员身份)运行控制台,以便能够使用

git config --global <setting>=<value>
那么您的
.gitconfig
文件可能位于

C:\Program Files (x86)\cygwin\home\<username>\.gitconfig
而不是

<cygwin directory path>\home\<username>\
\home\\

如果出于任何原因运行命令无效,则您也可以通过编辑
.gitconfig
文件自己输入信息

在文本编辑器(不是notepad.exe)中打开
C:\Users\\\.gitconfig
,并添加以下行(当然还有您的信息):


如果文件中已存在
[user]
节,请尝试将其正确合并,以避免重复。

您是如何输入命令的?你的操作系统是什么?Windows Vista-正如他在问题中所说的。在项目目录中尝试不使用全局参数。哦,天哪,你仍然在使用Vista!我很同情你。请更新你的问题,说明你是如何安装Git的,以及你使用的是哪个版本(msysgit、Cygwin或其他)?此外,您还可以在.downVorters上找到有关您的用户
.gitconfig
文件可能安装位置的信息,请解释您被否决的原因。我看不出我的答案有什么明显的错误。如果有任何错误,我将编辑我的答案以更正它。
.gitconfig
存储在
C:\Users\\.gitconfig
中,它是用户帐户的一部分,因此总是可写的(对于当前用户),无需提升权限。(但没有否决)@poke这假设用户的
.gitconfig
位于
C:\Users\\\.gitconfig
,就像他使用默认的msysgit安装一样。但是,如果原始海报使用了类似Cygwin的东西,并将其安装在
程序文件
的某个位置,该怎么办?然后,根据他如何配置Cygwin,他的主目录可能位于
程序文件
中的某个子文件夹中。在这种情况下,默认的Cygwin安装会将他的主目录放置在
C:\Program Files\Cygwin\home\
中,因为它位于
程序文件
下,原始海报可能需要提升权限才能修改其中的文件,包括
.gitconfig
文件。是的,我的
.gitconfig
位于
C:\Users\\\.gitconfig
中。直接编辑配置文件就可以了,但也可以从命令行找出他不能做的事情。另外,您假设用户的
.gitconfig
文件位于
C:\Users\\\.gitconfig
。并非所有在Windows上安装Git的情况都是如此。Git的默认Cygwin安装将把文件放在
C:\\home\
@Cupcake Fair point下。虽然如果没有来自OP.:/Mine的更多信息,就不可能说出这一点,但是我的信息在
C:\Users\\\.gitconfig
上。
C:\Users\<username>\
<cygwin directory path>\home\<username>\
[user]
    name = Your Name
    email = Your.Name@domain.tld