git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git-clone fails when current user is not in /etc/passwd

From
Taylor Braun-Jones <taylor@braun-jones.org>
Date
Dec 2, 2015, 20:10 UTC
Message-ID
<CAKfKJYsyHn7FUOu65AqbvjZD-wAyRScjqUL6kgGDCVzG1myZTQ@mail.gmail.com>

My use case it running git clone inside a docker container with `docker run --user $(id -u):$(id -g) --volume /foo:/foo ...`. I want all /foo/* file creation/access from inside the Docker container to be done as the current uid/gid of the host system.

Steps to reproduce:

mkdir /tmp/docker-git cat > /tmp/docker-git/Dockerfile <<EOF FROM ubuntu RUN apt-get update && apt-get install -y git-core EOF docker build -t git /tmp/docker-git/ docker run --user $(id -u):$(id -g) git git clone https://github.com/git/git.git /tmp/git # fatal: unable to look up current user in the passwd file: no such user echo $? # 128

My current workaround is:

cat >> /tmp/docker-git/Dockerfile <<EOF RUN git config --system user.name Docker && git config --system user.email docker@localhost EOF

But I don't see why this should be necessary just to clone a repo. I run complex build jobs inside a docker container using this approach and git-clone is the first command to fail due to the lack of a passwd file entry for the current user. Some complain to stderr, but still succeed.

Regards, Taylor

Next: Taylor Braun-Jones
Message 1 of 20 in “git-clone fails when current user is not in /etc/passwd”
  1. Taylor Braun-JonesDec 2, 2015
  2. Taylor Braun-JonesDec 9, 2015
  3. Duy NguyenDec 9, 2015
  4. Duy NguyenDec 9, 2015
  5. Taylor Braun-JonesDec 9, 2015
  6. Taylor Braun-JonesDec 10, 2015
  7. Jeff KingDec 10, 2015
  8. Junio C HamanoDec 10, 2015
  9. Jeff KingDec 10, 2015
  10. 0/3 git-clone fails when current user is not in /etc/passwdJeff King, Dec 10, 2015
  11. 1/3 ident: make xgetpwuid_self() a static local helperJeff King, Dec 10, 2015
  12. Junio C HamanoDec 10, 2015
  13. 2/3 ident: keep a flag for bogus default_emailJeff King, Dec 10, 2015
  14. Jeff KingDec 10, 2015
  15. 3/3 ident: loosen getpwuid error in non-strict modeJeff King, Dec 10, 2015
  16. Jeff KingDec 14, 2015
  17. Junio C HamanoDec 10, 2015
  18. Taylor Braun-JonesDec 11, 2015
  19. Junio C HamanoDec 10, 2015
  20. Taylor Braun-JonesDec 10, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.