-
Notifications
You must be signed in to change notification settings - Fork 239
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
.gitconfig file copy function not working when git settings are part of the postCreateCommand #98
Comments
As a workaround, I've been writing to the system "postCreateCommand": "sudo git config --system --add safe.directory ${containerWorkspaceFolder}", I agree that the dev container CLI should manage safe directories for the workspace internally, instead of having to explicitly add them via |
Nice idea for a work around, I can use this to help out while this request is open. But as you say, some kind of build in mechanism to control this would be immensely helpful. |
@HenrikStanley Does it not work to use |
Setting system gitconfig is a workaround in devcontainers/cli#98
* postCreateCommand is executed too early * If git config commands run in postCreate, a global .gitconfig will be created * Copy of local .gitconfig will be skipped if .gitconfig already exists in container * Move to later stage * devcontainers/cli#98 * microsoft/vscode-remote-release#4855 (comment)
* postCreateCommand is executed too early * If git config commands run in postCreate, a global .gitconfig will be created * Copy of local .gitconfig will be skipped if .gitconfig already exists in container * Move to later stage * devcontainers/cli#98 * microsoft/vscode-remote-release#4855 (comment)
* postCreateCommand is executed too early * If git config commands run in postCreate, a global .gitconfig will be created * Copy of local .gitconfig will be skipped if .gitconfig already exists in container * Move to later stage * devcontainers/cli#98 * microsoft/vscode-remote-release#4855 (comment)
* postCreateCommand is executed too early * If git config commands run in postCreate, a global .gitconfig will be created * Copy of local .gitconfig will be skipped if .gitconfig already exists in container * Move to later stage * devcontainers/cli#98 * microsoft/vscode-remote-release#4855 (comment) Signed-off-by: GitHub <noreply@github.com>
Fixing with microsoft/vscode-remote-release#6810. |
* postCreateCommand is executed too early * If git config commands run in postCreate, a global .gitconfig will be created * Copy of local .gitconfig will be skipped if .gitconfig already exists in container * Move to later stage * devcontainers/cli#98 * microsoft/vscode-remote-release#4855 (comment) Signed-off-by: GitHub <noreply@github.com>
When using the build in function in devcontainers that copies the host systems .gitconfig file into the container, it is not possible to also edit the .gitconfig file under the
postCreateCommand
part of the container build process, which could be needed to change things such as the safe.directory settings.For example, as part of the container build, I want to add the workspace folder to the copied .gitconfigs safe directory settings by having the follow in my
postCreateCommand
:git config --global --add safe.directory ${containerWorkspaceFolder}
However since the file at this point has not been copied into the container yet, using any git config command will create a .gitconfig file inside the container. Later in the build, a check runs that looks for an existing .gitconfig file and if it find ones, it does not copy.
Steps to Reproduce:
Copy Git Config
setting totrue
git config --global --add safe.directory ${containerWorkspaceFolder}
Suggested solutions:
The text was updated successfully, but these errors were encountered: