0

So I've recently started to work for a company and I'm trying to set a git environment for both my account, personal and the company. I found a simple solution for it which would be create a config file for multiple ssh keys. My question is, this works perfectly on the terminal, but when I try using vscode it asks me to set

Make sure you configure your 'user.name' and 'user.email' in git.

but arent these configurations globally made? is there a way for me to set these for each of my ssh keys?

hcp
  • 319
  • 2
  • 16

1 Answers1

1

You can specify a user.name and a user.email for each repo. Run below command in the git repo where you need to specify the user/email

git config user.name <user-name>
git config user.email <user-email>

Personnaly, i have a global configuration (i.e. git config --global user.name ) for my work (because i have a looooot of projects to deal with), and for my personnal projects (just a few) I do the local configuration like above.

Nicolas Voron
  • 2,916
  • 1
  • 21
  • 35
  • yeah, that seems to be the only solution :/ – hcp Jan 18 '22 at 17:52
  • 2
    Note that Git provides `includeIf` directives such that you can set `user.name` and `user.email` *conditionally*, based on the *location of the Git directory* in the file system. See [this question](https://stackoverflow.com/q/61543355/1256452). Whether this works in VSCode (which often doesn't seem to use Git at all, choosing instead to do its own fake Git stuff), I have no idea. – torek Jan 18 '22 at 22:06