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
[Devcontainer] move git setup to postStartCommand #40068
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kesselb
approved these changes
Aug 27, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you 👍
artonge
approved these changes
Aug 28, 2023
kesselb
added
4. to release
Ready to be released and/or waiting for tests to finish
and removed
3. to review
Waiting for reviews
labels
Aug 28, 2023
R0Wi
force-pushed
the
devcontainer-fix-git-config
branch
from
September 2, 2023 07:27
1dae47f
to
ff45fbf
Compare
@kesselb I guess the CI failures are unrelated? |
Most likely. |
susnux
force-pushed
the
devcontainer-fix-git-config
branch
from
October 11, 2023 00:07
ff45fbf
to
f74a12c
Compare
@R0Wi would you mind to sign you commit so it passed the DCO check? :) |
* 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>
R0Wi
force-pushed
the
devcontainer-fix-git-config
branch
from
October 13, 2023 16:19
f74a12c
to
9dd158b
Compare
@susnux done ✔️ |
Drone unrelated |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem summary
If you create a new devcontainer (locally), you will find the following in the logs:
Like shown, the
git config --global
commands executed insetup.sh
will create the file/home/devcontainer/.gitconfig
which will prevent that the.gitconfig
of the local user gets copied to the devcontainer. A similar issue is described here: devcontainers/cli#98.If you for example execute
git config --global user.name
after the container has been created, you will see that the username is empty and not set to the local git user of the host system.Fix
The fix here moves the
git config --global
commands to a later setup stage. The logs will now look like the following (see also microsoft/vscode-remote-release#4855 (comment)):Now
git config --global user.name
outputsRobin Windey
in my case.Copying the local git settings into the container is usually necessary to execute
git commit
(and git signing).