user2817219 user2817219 - 1 month ago 16
Git Question

git post-receive hook "empty ident name"

I have built the following post-receive hook:

#!/bin/sh
cd /var/node/heartbeat/ || exit
unset GIT_DIR
echo $USER
git pull --no-edit


When I'm pushing to the repository the following error is returned:

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


When running git config -l from the git user:

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


I don't understand why it's still thinking that my user.email and user.name are empty as git config -l tells me it's not. Does anyone know a solution/workaround for this problem?

Answer

To make sure this work, a git config --local -l needs to return the user name and email.

If it doesn't, go to that repo on the server, and type;:

git config user.name server
git config user.email server@server.com