You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Feel free to try that exact command with my dotfiles (since they're public anyway), but I expect it's reproducible with any GitHub username.
Expected behavior
Auth should not be required to clone a public repository over https. (In particular, since this is a bootstrapping step on a new machine, we might not yet have ssh keys, password vaults, etc.)
Output of command with the --verbose flag
docker run --rm -it ubuntu:latest /bin/bash -c 'apt-get update && apt-get install curl && sh -c "$(curl -fsLS git.io/chezmoi)" -- -b "$HOME/bin" init --verbose --apply -S ~/dotfiles mkasberg'[...]info found version 2.28.0 for latest/linux/amd64info installed /root/bin/chezmoichezmoi: https://mkasberg@github.com/mkasberg/dotfiles.git: authentication requiredUsername? ?
Output of chezmoi doctor
N/A - chezmoi is not yet installed.
Additional context
I'm 90% sure this is a bug with Chezmoi - apologies if I'm misunderstanding something here and this is from some other component or is expected behavior.
The text was updated successfully, but these errors were encountered:
Thanks for the report and the perfect reproduction case!
This is definitely a bug in chezmoi, and comes as an unwanted side effect of #2562. tl;dr including the username in the guessed repo URL causes chezmoi to prompt for authentication.
When you run chezmoi init mkasberg, chezmoi guesses the repo URL as https://mkasberg@github.com/mkasberg/dotfiles.git, which triggers the authentication prompt when git is not installed.
On the same machine without git installed, running chezmoi init --guess-repo-url=false https://github.com/mkasberg/dotfiles.git disables the repo URL guessing and does not prompt for authentication.
I wonder if it might not be worthwhile to have a --public-repo flag that can be used for this situation? That is, chezmoi init --public-repo mkasberg would guess the repo URL as https://github.com/mkasberg/dotfiles.git. It would be good for cases where one has a dotfile configuration that is read-only from clients but read-write from a primary system.
Describe the bug
When git is not installed, Chezmoi prompts for authentication to clone a public GitHub repository. Authentication should not be required.
To reproduce
This one-liner will reproduce the bug in a new, minimal Ubuntu Docker container:
docker run --rm -it ubuntu:latest /bin/bash -c 'apt-get update && apt-get install curl && sh -c "$(curl -fsLS git.io/chezmoi)" -- -b "$HOME/bin" init --apply -S ~/dotfiles mkasberg'
This is initializing config on a new machine using a slightly modified version of the init command from the https://chezmoi.io homepage.
Note that this works fine (does not prompt for auth) when git is installed:
docker run --rm -it ubuntu:latest /bin/bash -c 'apt-get update && apt-get install curl git && sh -c "$(curl -fsLS git.io/chezmoi)" -- -b "$HOME/bin" init --apply -S ~/dotfiles mkasberg'
Feel free to try that exact command with my dotfiles (since they're public anyway), but I expect it's reproducible with any GitHub username.
Expected behavior
Auth should not be required to clone a public repository over https. (In particular, since this is a bootstrapping step on a new machine, we might not yet have ssh keys, password vaults, etc.)
Output of command with the
--verbose
flagOutput of
chezmoi doctor
N/A - chezmoi is not yet installed.
Additional context
I'm 90% sure this is a bug with Chezmoi - apologies if I'm misunderstanding something here and this is from some other component or is expected behavior.
The text was updated successfully, but these errors were encountered: