【发布时间】:2014-09-11 01:57:48
【问题描述】:
我已经构建了以下接收后挂钩:
#!/bin/sh
cd /var/node/heartbeat/ || exit
unset GIT_DIR
echo $USER
git pull --no-edit
当我推送到存储库时,返回以下错误:
remote:
remote: From server.net:chris/heartbeat
remote: c0df678..5378ade master -> origin/master
remote:
remote: *** Please tell me who you are.
remote:
remote: Run
remote:
remote: git config --global user.email "you@example.com"
remote: git config --global user.name "Your Name"
remote:
remote: to set your account's default identity.
remote: Omit --global to set the identity only in this repository.
remote:
remote: fatal: empty ident name (for <git@server.net>) not allowed
当从 git 用户运行 git config -l 时:
user.name=server
user.email=server@server.com
core.autocrlf=input
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
remote.origin.url=git@server.net:chris/heartbeat.git
branch.master.remote=origin
branch.master.merge=refs/heads/master
我不明白为什么它仍然认为我的 user.email 和 user.name 是空的,因为 git config -l 告诉我它不是。有谁知道这个问题的解决方案/解决方法?
【问题讨论】:
-
您是否在服务器端(“远程”端)运行
git config?echo $USER的结果在哪里? -
是的,我在服务器端运行 git config 并且 echo $USER 的结果是错误的第一个空行。
-
如果您将
echo替换为id -a,您会得到“git”吗?钩子是用户git执行的吗? -
返回下面一行,所以是git用户执行的。 remote: uid=1000(git) gid=1000(git) groups=1000(git) 奇怪的是,当我在 su git 之后手动执行钩子时,没有返回错误。
-
而且,仍然在那个钩子中,
git config --local -l会返回什么?