我将我的 git 存储库克隆到远程服务器,使用 ssh 与其通信。使用 git fetch remote
有效,但是当我输入 git push remote
时,我得到了这个输出:
Counting objects: 242, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (184/184), done.
Writing objects: 100% (215/215), 238.00 KiB | 0 bytes/s, done.
Total 215 (delta 58), reused 0 (delta 0)
fatal: unable to look up current user in the passwd file: no such user
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly
我的服务器管理员说我的 ssh 用户配置在 chroot-jail 中。可以做些什么来解决这个错误?
最佳答案
事实证明,这在 2.6.5 中已“修复”——不再需要对许多 git 操作进行正确标识。
Here's the commit in question .
提交的 Gist :
ident: loosen getpwuid error in non-strict mode
If the user has not specified an identity and we have to turn to getpwuid() to find the username or gecos field, we die immediately when getpwuid fails (e.g., because the user does not exist). This is OK for making a commit, where we have set IDENT_STRICT and would want to bail on bogus input.
But for something like a reflog, where the ident is "best effort", it can be pain. For instance, even running "git clone" with a UID that is not in /etc/passwd will result in git barfing, just because we can't find an ident to put in the reflog.
Instead of dying in xgetpwuid_self, we can instead return a fallback value, and set a "bogus" flag. For the username in an email, we already have a "default_email_is_bogus" flag. For the name field, we introduce (and check) a matching "default_name_is_bogus" flag. As a bonus, this means you now get the usual "tell me who you are" advice instead of just a "no such user" error.
新xgetpwuid_self
现实现如下:
static struct passwd *xgetpwuid_self(int *is_bogus)
{
struct passwd *pw;
errno = 0;
pw = getpwuid(getuid());
if (!pw) {
static struct passwd fallback;
fallback.pw_name = "unknown";
#ifndef NO_GECOS_IN_PWENT
fallback.pw_gecos = "Unknown";
#endif
pw = &fallback;
if (is_bogus)
*is_bogus = 1;
}
return pw;
}
关于git 错误 "unable to look up current user in the passwd file: no such user"- 这是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20271926/