Local Repository-1
I have been working on application for my organization whose git repository cloned at C drive folder. I have set global configurations, and I have been able to perform commit, push, pull operations. This is private repository of my organization with unique user name, password and url. Everything working fine this repository.
Problem
Local Repository-2 Now, I want to create local repository of my own github project (different from first one) on the same system, but on different location. This repository have different configurations than other repository on the same system. So my concern is, how can I maintain repository specific configurations(user name, password, urls) on the same client system.
You have the below 2 options, Based on your preferred way(ssh or password) base access to git account:-
SSH based access:- create 2 ssh key-pair one for your company git account and one for your own git account. you need to add public ssh keys on both the git account by following this article.
Password bases access :- In this case you don't need to do anything, you just need to give the username and password on git push etc.
Important:- Now you need to add the git configs(git username,email etc) for your system, git has option to set these at gloabl and local leval. I would recommend setting the user.email and user.name setting globally according to your organization, to avoid commit to your company repo which has your private git username and email.
for example below git command will show the gloabl setting of git :-
And to set the git username and password in your private git repo, use below command, inside your repository
You can confirm, that your own private repo does not have, your company
username
andpassword
by runninggit config --edit
command orgit config --local --list
.