94

この質問は重複しているように見えますが、実際にはそうではありません。繰り返し続けるほんのわずかな違い。gitは、設定した後も、「あなたが誰であるかを教えてください」と言い続けます。私が走るときgit commit、これは私が得るものです....

$ git commit

*** Please tell me who you are.

Run

git config --global user.email "you@example.com"

git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'Obby@ObbyWorkstation.(none)')

しかし、私が走るgit config --global -lと、それは私に私のすべての詳細を与えます...

$ git config --global -l
user.name=myname
user.mail=me.myself@gmail.com
http.proxy=proxy.XX.XX.XX:XXXX

名前、電子メール、プロキシを変更しましたが、コマンドを実行すると、値が設定されていることを確認できる.gitconfigファイルでも正常に表示されます。私はまったくコミットできないので、何が欠けているのでしょうか。それは私が誰であるかを私に尋ね続けるたびに?

@sheuは私が変更したことを教えてくれましたが、それでも同じ問題です。私が設定したとき--local、それでもgit commit私に同じ質問をします。これが出力です

$ git config --local -l
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
core.hidedotfiles=dotGitOnly
user.name=myname
user.mail=me.myself@gmail.com
4

4 に答える 4

180

それはタイプミスです。電子メールにeuser.mailがない状態で誤って設定しました。グローバル構成で設定して修正してくださいuser.email

git config --global user.email "you@example.com"
于 2013-02-02T14:07:05.307 に答える
10

グローバルgitオプションを設定していますが、ローカルチェックアウトにオーバーライドが設定されている可能性があります。でもう一度設定してみてくださいgit config --local <setting> <value>。ローカルチェックアウトのファイルを見て.git/config、チェックアウトで定義されているローカル設定を確認できます。

于 2013-02-02T13:58:46.130 に答える
5

あなたはローカルを持っていますか、user.nameそれともuser.emailグローバルなものを上書きしていますか?

git config --list --global | grep user
  user.name=YOUR NAME
  user.email=YOUR@EMAIL
git config --list --local | grep user
  user.name=YOUR NAME
  user.email=

もしそうなら、それらを削除します

git config --unset --local user.name
git config --unset --local user.email

ローカル設定はクローンごとであるため、ローカルuser.nameおよびuser.emailマシン上のリポジトリごとに設定を解除する必要があります。

于 2014-05-21T21:36:03.487 に答える
0

設定を正しく設定した後でも、この問題が発生しました。git config

My scenario was issuing git command through supervisor (in Linux). On further debugging, supervisor was not reading the git config from home folder. Hence, I had to set the environment HOME variable in the supervisor config so that it can locate the git config correctly. It's strange that supervisor was not able to locate the git config just from the username configured in supervisor's config (/etc/supervisor/conf.d).

于 2020-06-12T21:09:07.467 に答える