Re: git-clone fails when current user is not in /etc/passwd
- From
Taylor Braun-Jones <taylor@braun-jones.org>
- Date
- Dec 9, 2015, 22:35 UTC
- Message-ID
- <CAKfKJYuP1E5aC7SPO91j-KS-P41pYaM7NkTJ9uG6b=VvxbOBwg@mail.gmail.com>
- In-Reply-To
- <CACsJy8Dc3Lsqa2zccoqH7UkDitqDbOTX3EXsUCcN9OHY=LfaKw@mail.gmail.com>
On Wed, Dec 9, 2015 at 1:24 PM, Duy Nguyen <pclouds@gmail.com> wrote:
Show 29 quoted lines
> On Wed, Dec 9, 2015 at 5:08 PM, Duy Nguyen <pclouds@gmail.com> wrote: >> On Wed, Dec 2, 2015 at 9:10 PM, Taylor Braun-Jones >> <taylor@braun-jones.org> wrote: >>> 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 >> >> It probably helps if you could get the stack trace to this message >> (printed from function xgetpwuid_self). I haven't checked if my >> personal laptop has docker to reproduce this.. In general we won't ask >> passwd if the user specifies name/email in the config file. But I >> still don't see why git-clone needs that info in the first place. > > Well.. reflog needs it. So either you disable reflog at clone time or > define name/email via config file. I don't see anything wrong with > this behavior.
Can't git just use "unknown" and "unknown@localhost" if the name or email can not be determined from xgetpwuid? This seems to be the way that Mercurial behaves.