Skip to main content

Git Personalization

Once you have created the ssh keys, before creating a new repo or before committing to a repo, you need to setup your git configs. Mainly the two git configs to setup are, your user name and your email. If you have set them right, your commits on github (or gitlab) would show your profile linked perfectly.

Config Types

Config can be global or local.

Global means these configs apply across any repository in your device.

Local means the configs are only valid to the current git repo that you are working with.

How to change configs

The main command to be used here is:

git config

Then mention the level of the config and the specific attribute that need to be added / changed.

In this, the attribute "user.name" will be changed for local repository.

git config --local user.name "Nisala Premathilake"

Let's change the email as well.

git config --local user.email "[email protected]" 

Great! Now the local configs are changed. But if you have to do this every time you create a repository, it would be difficult. To avoid that global configs can be used.

Let's add the global user.name and user.email:

git config --global user.name "Nisala Premathilake"

git config --global user.email "[email protected]"

Great! you have now setup the git configs.