How To Set Up Git From The Command Line
Download and install Git
You can download the program from the Git website for your operating system (Windows, MacOSX, or Linux/Unix).
To install Git directly from the command line, type the following into the terminal (if using Debian-based distributions like Ubuntu):
sudo apt-get install git-allFor MacOS, type:
git --versionand if Git is not already installed, the terminal will prompt you to install it.
Alternatively, if you have HomeBrew installed, you can install Git by typing:
brew install gitCreate a Git username
Create a Git username by entering the following into the terminal:
git config --global user.name "Jane Doe"Your name goes in the quotation marks. The –global option means that this will configure your Git username for every repo on your computer. You can also only do this for a single repo.
You can confirm that you have entered your username correctly by typing:
git config --global user.namewhich should return your name:
Jane DoeSet your email address
You can set your email address in Git as well, which is necessary if you plan on committing code to GitHub. Type the following into the terminal:
git config --global user.email "email@example.com"Once again to confirm you have entered your email correctly:
git config --global user.email email@example.comCreate a new Git repository
To create a new Git repository or reinitialize an existing Git repository type git init into the terminal.
For more about Git and documentation, check the Git website. For information on GitHub, such as how to set up a remote, check the GitHub documentation.