So if you have multiple git accounts, for example, one from the company and one is your personal, then how will you manage them on the same computer to avoid the conflicts.

Here is an easy way I use.

Go to ~/.ssh

Create a file named config(have no extension )

Open config file & add below codes. (change according to your account)

Account 1

# account_1 Host gitlab.com-account_1 HostName gitlab.com User git PreferredAuthentications publickey IdentityFile ~/.ssh/id_rsa_account_1

2. Account 2

# Account2 Host gitlab.com-Account2 HostName gitlab.com User git PreferredAuthentications publickey IdentityFile ~/.ssh/id_rsa_Account2

3. Account 3

# Account_3 Host github.com-Account3 HostName github.com User git PreferredAuthentications publickey IdentityFile ~/.ssh/id_rsa_Account_3

Add remote URL as follows Account 1 git remote add origin git@gitlab.com-account_1:group_name/repo_name.git Account 2 git remote add origin git@gitlab.com-Account2:group_name/repo_name.git Account 3 git remote add origin github.com-Account3:github_username/repo_name.git

