You can download Git for free from the following website: https://www.git-scm.com/
To begin using Git, first open your command shell.
On Windows, use Git Bash, which is included with Git for Windows. On Mac and Linux, you can use the built-in terminal.
The first step is to verify that Git is properly installed:
[user@localhost] $ |
git --version |
If Git is installed, it should display a message like git version X.Y.
Next, configure Git with your identity. This is important for version control systems because each Git commit uses this information.
[user@localhost] $ |
git config --global user.name "code7school-test" |
Update the username and email address to your own. You’ll likely need these details when you register for GitHub later on.
Note: Use —global to set the username and email for all repositories on your computer. If you want to set the username and email only for the current repository, omit —global. |
Now, let’s create a new directory for our project:
[user@localhost] $ |
mkdir myproject |
mkdir creates a new directory.
cd changes the current working directory.
Now that we’re in the right directory, we can start by initializing Git!
Note: If you have an existing folder or directory you’d like to use with Git:\ Navigate to it via the command line, or open it in your file explorer, right-click, and select “Git Bash Here.” |
Once you’ve navigated to the correct folder, you can initialize Git in that directory:
[user@localhost] $
|
git init |
You’ve just created your first Git repository!
Note: Git is now set to monitor the folder where you initialized it. Git creates a hidden directory to track changes. |