If you start working with a new computer, or a freshly formatted operating system, there's a couple of things that you need to do to get Git up and running properly.
Setting up your name:
Run the following command and substituting your name between the quotation marks of "my name":
git config --global user.name "my name"
To verify your name is set, run:
git config --global user.name
This will return your name if it's set.
Set your email address globally:
git config --global user.email firstname.lastname@example.org
To be able to upload directly from your terminal, you'll also need to create an SSH key and tell Github about it:
The following command will create a new key:
ssh-keygen -t rsa -C "email@example.com" -b 4096
Once you have a key, run the following command to view it:
The next step is to add the public key to your Github account.
First, you want to copy the key. You can simply copy all the text displayed by the command above. Alternatively you can run one of the following commands:
pbcopy < ~/.ssh/id_rsa.pub
On Linux, assuming you have xclip installed, run:
xclip -sel clip < ~/.ssh/id_rsa.pub
If you don't have xclip installed, you can do so on Debian-based systems with:
sudo apt-get install xclip
Once you have the key in your clipboard, on github.com, select the icon picture on the top-right hand corner of the page.
From the drop-down menu select settings.
On the settings page, in the left menu bar select 'SSH and GPG keys'.
On thhe SSH and GPG Keys page, click the green button for a New SSH Key.
On the new key page, give your key a name, then paste the key from keyboard directly into the key box.
You can now commit directly from the terminal of your new computer.
Note: If after following the instructions above you find that Git is asking for your username and password when you commit, ensure that your remote address is SSL rather than HTTPS. You can verify by running git remote -v. The address should begin with git@ rather than https.
This page has plenty of other custom ways that you can configure Git on your computer: https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration