Re: git-clone fails when current user is not in /etc/passwd
- From
Taylor Braun-Jones <taylor@braun-jones.org>
- Date
- Dec 9, 2015, 15:23 UTC
- Message-ID
- <CAKfKJYu1frw5QLkkkZo-F1kxbkLREpyudFiCST6h7hSS=LPdmw@mail.gmail.com>
- In-Reply-To
- <CAKfKJYsyHn7FUOu65AqbvjZD-wAyRScjqUL6kgGDCVzG1myZTQ@mail.gmail.com>
What's the feeling on this one? If there's agreement in principle that git-clone should not fail when the current UID cannot be found in /etc/passwd then I'm happy to submit a patch to fix it.
Thanks, Taylor
On Wed, Dec 2, 2015 at 3:10 PM, Taylor Braun-Jones <taylor@braun-jones.org> wrote:
Show 33 quoted lines
> 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