Let's say you you need to clone a repository, and you've been given the command to run with the repository URL. Great! But where do you run it?
This article will guide you through the steps to running your first git commands. First though, let's check if you have git installed.
Open up the command prompt/terminal:
- For Windows, type into the search bar next to the start button: cmd.exe
- For Mac, go to Finder > Applications > Utilities > Terminal
Check installation
First, let's type the following into the command prompt/terminal to see your git version:
git --version
If git is installed correctly, you should see something like this:
git version 2.26.2.windows.1
Otherwise, if it says that git is not recognized, you can install git here: Install Git.
Once it's installed, you may need to restart your PC. Then run the above command again to insure it has installed correctly.
Where do I go now?
Great! Now that I have git installed, where do I run the commands?
You may have already guessed it, but the simplest way to run git commands is exactly as you have done, right in the terminal. You can also use PowerShell if you wish, which is useful if later you wish to create complex procedures with git commands.
My personal preference however is to use the git bash shortcut in Windows. Now that you have git installed, you should be able to access this by right clicking within your repository folder:
Clicking "Git Bash here" will bring up a window formatted specially for git commands, already starting in your repository directory: