git error "unable to look up current user in the passwd file: no such user" - what does this mean?
git, git-push, ssh
Solution
It turns out this was "fixed" in 2.6.5 -- no longer requiring a proper identification for many git operations.
Here's the commit in question.
The gist of the commit:
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.
The new `xgetpwuid_self` is now implemented as follows:
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;
}
Problem
I cloned my git repo to a remote server, using ssh to communicate with it. Using `git fetch remote` works, but when I type `git push remote` I get this output: ``` 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 ``` My server admin says that my ssh user is configured inside a chroot-jail. What could be done to solve this error?