git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git-clone fails when current user is not in /etc/passwd
@ 2015-12-02 20:10 Taylor Braun-Jones
  2015-12-09 15:23 ` Taylor Braun-Jones
  2015-12-09 16:08 ` Duy Nguyen
  0 siblings, 2 replies; 20+ messages in thread
From: Taylor Braun-Jones @ 2015-12-02 20:10 UTC (permalink / raw)
  To: git

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

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2015-12-14 15:07 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-02 20:10 git-clone fails when current user is not in /etc/passwd Taylor Braun-Jones
2015-12-09 15:23 ` Taylor Braun-Jones
2015-12-09 16:08 ` Duy Nguyen
2015-12-09 18:24   ` Duy Nguyen
2015-12-09 22:35     ` Taylor Braun-Jones
2015-12-10 18:33       ` Taylor Braun-Jones
2015-12-10 18:34       ` Jeff King
2015-12-10 19:57         ` Junio C Hamano
2015-12-10 20:40           ` Jeff King
2015-12-10 21:32             ` [PATCH 0/3] " Jeff King
2015-12-10 21:33               ` [PATCH 1/3] ident: make xgetpwuid_self() a static local helper Jeff King
2015-12-10 23:39                 ` Junio C Hamano
2015-12-10 21:35               ` [PATCH 2/3] ident: keep a flag for bogus default_email Jeff King
2015-12-10 22:54                 ` Jeff King
2015-12-10 21:41               ` [PATCH 3/3] ident: loosen getpwuid error in non-strict mode Jeff King
2015-12-14 15:07                 ` Jeff King
2015-12-10 23:44               ` [PATCH 0/3] git-clone fails when current user is not in /etc/passwd Junio C Hamano
2015-12-11  2:20               ` Taylor Braun-Jones
2015-12-10 18:43     ` Junio C Hamano
2015-12-10 18:52       ` Taylor Braun-Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).