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

Option to remove git credential config options from global git config in devcontainer #10587

Open
MartinLoeper opened this issue Dec 20, 2024 · 2 comments
Assignees
Labels
containers Issue in vscode-remote containers feature-request Request for new features or functionality
Milestone

Comments

@MartinLoeper
Copy link

I do not know if this was previously discussed here in the issues. If so, feel free to close.

The devcontainers extension forwards the git credentials configuration by creating the following config in my devcontainer's global git config:

[credential]
	helper = "!f() { /home/vscode/.vscode-server/bin/f1a4fb101478ce6ec82fe9627c43efbf9e98c813/node /tmp/vscode-remote-containers-1ed05baf-189c-413c-bec8-ff77cfbb3f87.js git-credential-helper $*; }; f"

However, when I have custom global git configs á la:

[credential "https://mydomain.org"]

they are retained in the global git config.

However, the paths to the git-credentials plugins referenced there are not accessible from within the devcontainer.

Is there an option to make the devcontainer remove these other git credential configurations from global git config file?
If not, is there a good reason not to remove them?

And lastly: Is there an easy way to script the removal of these sections? I'm thinking of something like a postCreate hook in devcontainer.json or so.

Example error message which is from my NixOS devcontainer setup each time I pull or push something:

/nix/store/3fvqdfrjv01vgh5j22yigsbkynv2sqw2-git-credential-manager-2.5.1/bin/git-credential-manager store: 1: /nix/store/3fvqdfrjv01vgh5j22yigsbkynv2sqw2-git-credential-manager-2.5.1/bin/git-credential-manager: not found
@vs-code-engineering vs-code-engineering bot added the containers Issue in vscode-remote containers label Dec 20, 2024
@chrmarti
Copy link
Contributor

You could use the "postStartCommand" in the devcontainer.json to update the ~/.gitconfig. Another option is to configure a dotfiles repository in the VS Code user settings that includes a ~/.gitconfig, that will prevent the local ~/.gitconfig from being copied over.

Does your [credential "https://mydomain.org"] section just contain a custom credential handler?

@chrmarti chrmarti added the info-needed Issue requires more information from poster label Jan 30, 2025
@MartinLoeper
Copy link
Author

MartinLoeper commented Jan 30, 2025

You could use the "postStartCommand" in the devcontainer.json to update the ~/.gitconfig. Another option is to configure a dotfiles repository in the VS Code user settings that includes a ~/.gitconfig, that will prevent the local ~/.gitconfig from being copied over.

These sound like reasonable workarounds! Thanks! :)

Does your [credential "https://mydomain.org"] section just contain a custom credential handler?

Since I am using NixOS, these sections contain references to binaries in the Nix store which are not accessible inside the devcontainer. They also contain more like settings for the credential helper. I think a solution would be to remove all of these credential helpers for the host since they are used by the vscode helper anyway. The requests are forwarded to the host aren't they?

Edit: sorry just closed the issue accidently

@chrmarti chrmarti reopened this Jan 30, 2025
@chrmarti chrmarti removed the info-needed Issue requires more information from poster label Jan 30, 2025
@chrmarti chrmarti added this to the Backlog milestone Jan 30, 2025
@chrmarti chrmarti added the feature-request Request for new features or functionality label Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
containers Issue in vscode-remote containers feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

2 participants