How to Set Up Git?

Git is responsible for everything GitHub-related that happens locally on your computer.

ยท

2 min read

How to Set Up Git?

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.

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).

Git-Logo-1788C.png

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.

Buy Me A Coffee
ย