Using multiple git accounts in VsCode

I want to use different git account for my two projects in same device. Is it possible to do so . Without deleting git config again and again. Sorry if that's too dumb question
4 Replies
Shoodey
Shoodey•2y ago
Heyah - I use a ~/.gitconfig with content:
[includeIf "gitdir:~/PATH-A/"]
path = ~/.IDENTITY-A.gitconfig
[includeIf "gitdir:~/PATH-B/"]
path = ~/.IDENTITY-B.gitconfig
[includeIf "gitdir:~/PATH-A/"]
path = ~/.IDENTITY-A.gitconfig
[includeIf "gitdir:~/PATH-B/"]
path = ~/.IDENTITY-B.gitconfig
and then ~/.IDENTITY-A.gitconfig looks something like this, which also allows me to use different ssh identities (mainly one for personal use and the other for work
[user]
name = John Doe
email = email@example.com
[core]
editor = code -w
[init]
defaultBranch = master
[core]
sshCommand = ssh -i ~/.ssh/IDENTITY-A/id_rsa
[user]
name = John Doe
email = email@example.com
[core]
editor = code -w
[init]
defaultBranch = master
[core]
sshCommand = ssh -i ~/.ssh/IDENTITY-A/id_rsa
Please let me know if you have more questions 🙂
Pluto
Pluto•2y ago
Hi. Thanks a alot for answering I found this today on stackoverflow. It's very detailed and allows to use different account across different projects
Pluto
Pluto•2y ago
Stack Overflow
I have 2 GitHub accounts. How can I use both when I am working in V...
I have 2 different GitHub accounts: A personal account for my own needs, and a company GitHub account that I manage. I use V.S. Code for both company & personal projects, and I was hoping to fi...
Shoodey
Shoodey•2y ago
glad that helped 🙂
Want results from more Discord servers?
Add your server