ocurrent / ocurrent/ocaml-dockerfile

Default git credentials setup

Open
#74 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
OCaml
Stars
68
Forks
22
Avg merge
5h 56m
Merged PRs (30d)
3

Description

The Dockerfiles and images generated with this for the ocaml/opam images set up default git credentials:
https://github.com/avsm/ocaml-dockerfile/blob/f184554282a3836bf3f1c34d20e77d0530f8349d/src-opam/dockerfile_linux.ml#L24-L28
Why is this done/desirable?

This creates /home/opam/.gitconfig, which prevents the ocaml/opam images from being used out-of-the-box as devcontainers, because apparently the presence of this file prevents the automatic use of outside git credentials: https://code.visualstudio.com/docs/remote/containers#_sharing-git-credentials-with-your-container.
Thus as a devcontainer base image, inside the container you'd be accidentally committing everything as Docker <docker@example.com> without realizing that the usual mechanism of it using outside git credentials hasn't worked. Then one has to rewrite git history to fix the author information of such commits.
Moreover, even without using as part as devcontainer, but for other purposes of doing git commits inside such containers will use those default credentials instead of giving the usual prompt of asking the user to set them up, because they've already been set up by the base image.

Currently I have to work around this by using RUN rm ~/.gitconfig as an extra step on top of these base images. It isn't much, but I fail to see why I'd ever want to commit as some weird default user I haven't explicitly set up myself.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src-opam/dockerfile_linux.ml at lines 24-28 and inspect how the generated Dockerfiles create /home/opam/.gitconfig. Determine why the default credentials are added and whether removing that setup preserves the intended image behavior; done means generated ocaml/opam images no longer impose default Git author information or block external credential use.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, dockerfile, git, ocaml
Domain
build-system, devops
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.