git post-receive hook“空标识名" [英] git post-receive hook "empty ident name"

查看:22
本文介绍了git post-receive hook“空标识名"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经构建了以下接收后挂钩:

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

从 git 用户运行 git config -l 时:

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

我不明白为什么它仍然认为我的 user.email 和 user.name 是空的,因为 git config -l 告诉我它不是.有谁知道这个问题的解决方案/解决方法?

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?

推荐答案

为了确保这个工作,一个 git config --local -l 需要返回用户名和电子邮件.

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

如果没有,请转到服务器上的那个 repo,然后输入;:

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

这篇关于git post-receive hook“空标识名"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆