Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

After installing Git, verify it runs, set the name and email that will appear in your commits, then either initialize your own project or clone one that already exists. You can do all of that locally; connecting to a hosting service and authenticating are separate steps.

Minute 0–1: Confirm Git is available

Open a terminal (or Git Bash on Windows) and run:

git --version

If Git is installed correctly, the command prints a version number. If the command is not recognized or cannot be found, use the official installation instructions for your operating system rather than guessing at a platform-specific fix: Installing Git. The available installation route differs by platform; the official guide covers package managers for Linux distributions and Xcode Command Line Tools as one option on macOS.

Minute 1–3: Set the identity recorded in commits

Before creating commits, configure the name and email Git should record as your author identity:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
git config --global user.name "Your Name"
git config --global user.email "you@example.com"

Replace the example values with the identity you want attached to your commits. These settings are user-wide defaults, not a hosting-site account or login. Git records them in commits; they do not create an account with a code-hosting provider. See First-Time Git Setup.

If a particular project needs a different identity, run the same commands from that repository but omit --global. Repository-specific configuration can override your global defaults.

Minute 3–4: Check which settings Git will use

To inspect configuration values and where they came from, run:

git config --list --show-origin

Git can read settings from system, user, and repository configuration files. When the same setting appears at different levels, the more specific setting takes precedence. The origin shown beside a value can help explain why Git is using an unexpected name, email, editor, or other option. See the git-config reference.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Minute 4–5: Choose the right way to start

These commands solve different problems: git init starts tracking a local folder as a repository, while git clone obtains an existing repository and its history.

For a project folder you already have

In a terminal, move into the folder and run:

git init

This creates Git repository metadata in that directory. It does not download a remote project.

For a repository that already exists elsewhere

Use the repository’s clone URL:

git clone <repository-url>

Replace <repository-url> with the URL provided by the host. Cloning creates a local copy of the existing repository and its history. Git’s user manual explains both paths: Git User Manual.

Minute 5–8: Make a first local commit

For a repository you just initialized, add only the files you intend to record, review the staged changes, and commit them:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
git add <file-or-folder>
git status
git diff --staged
git commit -m "Add initial project files"
  1. git add stages the specified file or folder for the next commit. Choose deliberately rather than adding everything automatically.
  2. git status shows which changes are staged and which are not.
  3. git diff --staged lets you inspect the staged content before recording it.
  4. git commit records the staged changes in your local repository. Replace the example message with a short description of the change.

Check that you have not staged credentials, private keys, or other secrets. Generated files may also be inappropriate to commit, depending on the project; there is no single ignore rule that fits every repository. Git’s getting-started guide demonstrates the git init, git add, and git commit flow: First-Time Git Setup.

Minute 8–10: Set optional preferences

You can use Git without changing these preferences. Set them only if they suit your workflow.

Choose an editor

If Git opens an editor you do not want to use, configure core.editor with a command available on your computer. For example:

git config --global core.editor "<editor-command>"

Replace the example with your editor’s command; the correct value depends on the editor and how it is installed. Configuration options are described in the git-config reference.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose a default branch name for new repositories

If you want new repositories you initialize to use a particular default branch name, set it like this:

git config --global init.defaultBranch main

This affects repositories created in the future; it does not rename an existing repository’s branch. The git-init documentation describes initialization options.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What happens when you connect to a remote?

A local commit is saved in your local repository. Pushing or otherwise working with a remote host is separate, and Git may ask for credentials when an operation contacts that host. The credential method depends on your host and setup, so there is no single credential-helper command that applies to everyone. See Git’s credentials documentation.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.