Hello π good people. In this blog post, we will learn how to set up Git on your local computer. Because Git is responsible for everything GitHub-related that happens locally on your computer.
Those who don't know what Git & GitHub is, kindly read this post to know about Git & GitHub Introduction to Git & GitHub for Beginners.
Table of contents
Download and Install Git
To download & install Git just go to this following page and download Git for your preferable OS (macOS, Windows, Linux/Unix).
Set your Git username Globally
You can change the name that is associated with your Git commits using the git config
command. The new name you set will be visible in any future commits you push to GitHub from the command line.
Open Git Bash.
Set your Git username
$ git config --global user.name "John Doe"
- Recheck that you've given the right username
$ git config --global user.name
> John Doe
Set your Git username for a Single Repository
Open Git Bash.
Change the current working directory to the local repository where you want to configure the name that is associated with your Git commits.
Set your Git username
$ git config user.name "John Doe"
- Recheck that you've given the right username
$ git config user.name
> John Doe
Set your email globally
Open Git Bash.
Set your email address in Git. You can use your GitHub-provided
no-reply
(if you change your email public to private in GitHub) email address or any email address.
$ git config --global user.email "email@example.com"
- Recheck that you've given the right email
$ git config --global user.email
> email@example.com
Set your email for a single repository
Open Git Bash.
Change the current working directory to the local repository where you want to configure the email address that is associated with your Git commits.
Set your email address in Git. You can use your GitHub-provided
no-reply
(if you change your email public to private in GitHub) email address or any email address.
git config user.email "email@example.com"
- Recheck that you've given the right email
$ git config user.email
> email@example.com
Thanks for reading this post. Stay tuned for more.
You can find me here also.
Top comments (2)
Another tip is about setting the favorite editor for writing commits.
It can use following code snippets to complete this:
As we can see, it can use the above command to set favorite editor for writing commits globally. And we can also use the following command to set editor for the single repository:
We can use the
git config --list
to get all setting lists:Thanks for sharing.