79741805

Date: 2025-08-21 04:08:20
Score: 2
Natty:
Report link

The issue is that your Docker build does not have your Git credentials.

If it is a private repo, the simplest fix is to make a build argument with a personal access token:

ARG GIT_TOKEN
RUN git clone https://${GIT_TOKEN}@github.com/username/your-repo.git

Then build with:

docker build --build-arg GIT_TOKEN=your_token_here -t myimage .

Just make sure that you are using a personal access token from GitHub, and not your password - GitHub does not allow password auth anymore.

If it is a public repo and is still not working, try:

RUN git config --global url."https://".insteadOf git://
RUN git clone https://github.com/username/repo.git

Sometimes the git:// protocol will mess up Docker images.

Edit: Also, as mentioned in comments, be careful about tokens in build args - because they may appear in image history, and this could pose a risk. For production purposes, consider using Docker BuildKit's --mount=type=ssh option instead.

Reasons:
  • Blacklisted phrase (2): still not working
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Mahitha Adapa