Manage multiple Git accounts on Linux Ubuntu

Hi there :slight_smile:

I would like to manage my private and my professional Git account on one machine.
I use Linux Ubuntu 20.04.
I’ve found in the web some instructions about setting up with SSH, but the point is, my private account is on SSH and my professional account is on HTTPS.

In my home directory I have allready my .gitconfig file and I created a .git-credentials file.

Are there any solutions or some of you have solved this problem?

Cheers Hubes :kissing_heart:

Hello :slight_smile:

…got it! I’ve set just my professional Git account with

git config user.name ....

Is there a way to set multiple directories in my working tree on my professional account in .gitconfig file?

You can set in your home directory in .gitconfig like you’ve done, but then that is system-wide if you like for all repositories unless you specify otherwise. What you can do is inside your project_directory/.git/config file, you can add the following:

[user]
email = my@email.address
name = My Name

obviously replacing these details. That way for each project you can use different credentials for the commits, etc.