Replies: 2 comments 2 replies
-
|
Thank you for opening! Looping in @chrmarti for any thoughts. |
Beta Was this translation helpful? Give feedback.
2 replies
This comment was marked as spam.
This comment was marked as spam.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi folks,
I noticed that when I spin a new devcontainer (in VS Code) the gitconfig file shared with the new container is the one located in my $HOME directory (
~/.gitconfig).However, as most of us (I believe), I use my computer to work not only on the projects of my clients but also on my personal projects and, depending on whose the project I'm working at belongs to, my credentials need to be different.
When developing locally, I handle this in my global
.gitconfigwhere I have a couple of[includeIf: "gitdir:..."]clauses to include the appropriate.gitconfigdepending on the folder where the I'm working with project is located at.The diagram below depicts how my projects are organized in my local computer:
The problem I'm facing is that those more specific
.gitconfigfiles (located undermy-client-1andmy-client-2folders) are ignored so when developing inside the container I only have those settings located in my global.gitconfig.I was wondering if wouldn't be more helpful if, instead of copying the global config into the container, to copy the result of the
git config --list(properly formatted) as the content of the global.gitconfiginside the container.Does that make sense to anyone else besides me?
At the moment, I have a couple of scripts that:
initializeCommandhook;/workspaces/folder during thepostStartCommandhook and;postStartCommandhook, adds to the~/.gitconfigtheincludeclause to include the/workspaces/.gitconfigThe problem with this approach is that I don't see means to wrap this whole mechanism into a "base" devcontainer image because I rely on the
initializeCommandhook to have access to the host file system and copy the parent gitconfig into the project folder. Devcontainer features don't supportinitializeCommandhook so it isn't an option, unfortunately.I'm happy to hear any other way deal with this situation if someone has a better approach.
My apologies if this not the right place for this kind of discussion. I'll be glad to move it to a more appropriate place if somebody point me to the right direction.
I wish you all the best.
Beta Was this translation helpful? Give feedback.
All reactions