Git error "could not find the current user in the passwd file: there is no such user" - what does this mean?

I cloned the git repository to a remote server using ssh to contact 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 administrator says my ssh user is configured inside chroot-jail. What can be done to solve this error?

+6
source share
2 answers

This error message is returned by wrapper.c :

 struct passwd *xgetpwuid_self(void) { struct passwd *pw; errno = 0; pw = getpwuid(getuid()); if (!pw) die(_("unable to look up current user in the passwd file: %s"), errno ? strerror(errno) : _("no such user")); return pw; } 

This means that the common library getpwuid function does not find the password entry in / etc / passwd for the user account, the git process is called

This is how the nscd service did not know how to resolve some services.

Ask your administrator to double-check the folder with the account (call her $D ), as shown in this article . Especially his $D/etc folder:

 cp -fv /etc/{group,prelink.cache,services,adjtime,shells,gshadow,shadow,hosts.deny,localtime,nsswitch.conf,nscd.conf,prelink.conf,protocols,hosts,passwd,ld.so.cache,ld.so.conf,resolv.conf,host.conf} $D/et 
+3
source

Turns out this was “fixed” in 2.6.5 - the correct identification for many git operations is no longer required.

This is about a team .

The essence of fixation:

ident: ease getpwuid error in lax mode

If the user does not specify an identifier, and we must call getpwuid () to find the username or gecos field, we die immediately when getpwuid does not work (for example, because the user does not exist). This is OK to commit, where we set IDENT_STRICT and would like to get a dummy input.

But for something like reflog, where the identifier is the “best effort”, it can be a pain. For example, even running “git clone” with a UID that is not in / etc / passwd will result in git barfing, simply because we cannot find the identifier to be placed in the reflog.

Instead of dying in xgetpwuid_self, we can instead return the backup value and set the dummy flag. For the username in the email, we already have the flag "default_email_is_bogus". For the name field we enter (and check) the corresponding flag "default_name_is_bogus". As a bonus, this means that now you get the usual advice "tell me who you are" instead of just the error "there is no such user."

The new xgetpwuid_self 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; } 
+1
source

Source: https://habr.com/ru/post/958999/


All Articles