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

Devcontainer support for import of Git config files within the XDG_CONFIG_HOME/git directory #9469

Closed
arrrgi opened this issue Feb 2, 2024 · 3 comments
Assignees
Labels
containers Issue in vscode-remote containers info-needed Issue requires more information from poster

Comments

@arrrgi
Copy link

arrrgi commented Feb 2, 2024

I am following the XDG Base Directory spec and my Git config file(s) are located in ~/.config/git directory on my WSL2 instance. My current understanding of the Devcontainers remote extension is that the "dev.containers.copyGitConfig" expects users to have all of their Git config within ~/.gitconfig file.

I'd like to request the addition of a feature to support sourcing Git config and any includes from the Git config file from either:

  • $HOME/.gitconfig
  • $HOME/.config/git/config
  • $XDG_CONFIG_HOME/git/config

Further, if the config file provides one or more of include.path = ~/.config/git/filename or include.path = ~/otherfile directives, the files should also be copied into the same locations within the Devcontainer user home directory.

One suggestion might be to provide an additional optional Devcontainers config parameter to specify the path to the parent config file, with the extension testing for the presence of the file, and parsing the file for the include.path file references to be copied.

Environment:

  • VSCode Version: 1.92.0
  • Local OS Version: MacOS 14.5
  • Remote OS Version: Ubuntu 22.04.4 LTS
  • Remote Extension/Connection Type: Remote Devcontainer via SSH

References

@chrmarti
Copy link
Contributor

If $XDG_CONFIG_HOME is set $XDG_CONFIG_HOME/git/config is copied otherwise $HOME/.config/git/config is copied - if they exist.

Please append the Dev Containers log from a rebuild if this doesn't work. (F1 > Dev Containers: Show Container Log)

@chrmarti chrmarti added the info-needed Issue requires more information from poster label Dec 13, 2024
@arrrgi
Copy link
Author

arrrgi commented Dec 13, 2024

Thanks for picking this up @chrmarti

I can confirm that the local config from $XDG_CONFIG_HOME/git/config is copied, however, no other files from the same folder were copied.

Here is my Git config contents for reference, it uses the include directive to bring in the contents of the other Git config files, rather than having all my settings contained within the single file.

$ cat /home/vscode/.config/git

[include]
  path = ~/.config/git/standard
  path = ~/.config/git/user
  path = ~/.config/git/aliases
[credential]
        helper = "!f() { /home/vscode/.vscode-server/bin/65edc4939843c90c34d61f4ce11704f09d3e5cb6/node /tmp/vscode-remote-containers-90a0e3c9-583c-4e48-b268-7f63364ba399.js git-credential-helper $*; }; f"
[credential "https://dev.azure.com"]
        useHttpPath = true

Here are the appropriate parts of the log:

[14832 ms] Start: Run in container: # Test for /home/vscode/.config/git/config and git
[14840 ms] Port forwarding connection from 59887 > 46391 > 46391 in the container.
[14841 ms] Start: Run in container: /home/vscode/.vscode-server/bin/65edc4939843c90c34d61f4ce11704f09d3e5cb6/node -e 
[14866 ms] Ignoring option 'skip-requirements-check': not supported for server.
[14873 ms] [22:08:00] 
[14898 ms] Port forwarding 59887 > 46391 > 46391 stderr: Connection established
[14950 ms] 
[14950 ms] 
[14950 ms] Start: Run in container: # Copy /Users/rgillson/.config/git/config to /home/vscode/.config/git/config
[14952 ms] 
[14952 ms] 
[14952 ms] Start: Run in container: # Cleaning up git config
[14955 ms] 
[14955 ms] 
[14956 ms] Start: Run: git config --global --get gpg.ssh.allowedSignersFile
[14957 ms] Start: Run in container: command -v git >/dev/null 2>&1 && git config --global --replace-all credential.helper '!f() { /home/vscode/.vscode-server/bin/65edc4939843c90c34d61f4ce11704f09d3e5cb6/node /tmp/vscode-remote-containers-90a0e3c9-583c-4e48-b268-7f63364ba399.js git-credential-helper $*; }; f' || true

Further observation

It's appropriate to note that gpg.ssh.allowedSignersFile is set in my ~/.config/git/user include, so this is also not set within the Devcontainer as the user file is missing.

@chrmarti
Copy link
Contributor

Continuing in #3331. Thanks.

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 info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

3 participants