Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install.sh fails with non-default git config clone.defaultRemoteName #3547

Open
ryan-williams opened this issue Mar 13, 2025 · 1 comment · May be fixed by #3548
Open

install.sh fails with non-default git config clone.defaultRemoteName #3547

ryan-williams opened this issue Mar 13, 2025 · 1 comment · May be fixed by #3548

Comments

@ryan-williams
Copy link

Dockerfile:

FROM ubuntu:24.04
RUN apt update -y && apt install -y git wget

# ‼️ non-standard remote name causes `install.sh` to fail
ARG defaultRemote=upstream
RUN git config --global clone.defaultRemoteName $defaultRemote
RUN wget -q https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.2/install.sh

# ❌ fatal: 'origin' does not appear to be a git repository
RUN bash install.sh

Build fails when the default cloned remote name is not origin:

docker build -t nvm .  # ❌ Fails when default remote name is `upstream`
docker build -t nvm --build-arg defaultRemote=origin .  # ✅ OK

Here's the full failure output:

$ docker build -t nvm .
[+] Building 13.2s (9/9) FINISHED                                                                   docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                0.0s
 => => transferring dockerfile: 288B                                                                                0.0s
 => [internal] load metadata for docker.io/library/ubuntu:24.04                                                     0.4s
 => [auth] library/ubuntu:pull token for registry-1.docker.io                                                       0.0s
 => [internal] load .dockerignore                                                                                   0.0s
 => => transferring context: 2B                                                                                     0.0s
 => CACHED [1/5] FROM docker.io/library/ubuntu:24.04@sha256:72297848456d5d37d1262630108ab308d3e9ec7ed1c3286a32fe09  0.0s
 => [2/5] RUN apt update -y && apt install -y git wget                                                             12.2s
 => [3/5] RUN git config --global clone.defaultRemoteName upstream                                                  0.1s
 => [4/5] RUN wget -q https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.2/install.sh                               0.1s
 => ERROR [5/5] RUN bash install.sh                                                                                 0.3s
------
 > [5/5] RUN bash install.sh:
0.103 => Downloading nvm from git to '/root/.nvm'
=> Cloning into '/root/.nvm'...
0.303 fatal: 'origin' does not appear to be a git repository
0.303 fatal: Could not read from remote repository.
0.303
0.303 Please make sure you have the correct access rights
0.303 and the repository exists.
0.304 Failed to fetch origin with v0.40.2. Please report this!
------
Dockerfile:6
--------------------
   4 |     RUN git config --global clone.defaultRemoteName $defaultRemote
   5 |     RUN wget -q https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.2/install.sh
   6 | >>> RUN bash install.sh
   7 |
--------------------
ERROR: failed to solve: process "/bin/sh -c bash install.sh" did not complete successfully: exit code: 1

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/15rwdgslgqiro3al8ak02cver

install.sh assumes the cloned remote will be named origin in a few places, most significantly here.

@ljharb
Copy link
Member

ljharb commented Mar 13, 2025

Indeed, origin is hardcoded - there's not a great way i'm aware of to adapt to that, but i'll take a look at #3548.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants