Setup Your git User

Git configs for your user will be located in the ~/.gitconfig file.
Use git config --list to view your users current configurations.
If the ~/.gitconfig file does not exist, or has no configs, git config --list will return nothing.

Git stores configs for the user, as well as for the repo. Running git config --list from within a repo directory will show additional results.

Use the following commands to create your users .gitconfig file and/or overwrite any existing entries:

$ git config --global user.name "Daniel Watts"
$ git config --global user.email mrwattz@gmail.com
$ git config --global init.defaultBranch main
  • user.name is the name which will show on your commits.
  • user.email should be the email used for your Github account.
  • init.defaultBranch is the default name given to the root branch for new repos. The default is master.

List the configs now to make sure everything is setup.

dwatts@ral-venus:~$ git config --list
credential.helper=osxkeychain
user.name=Daniel Watts
user.email=mrwattz@gmail.com
init.defaultbranch=main

Now you can setup your Github login with an SSH key-pair.