GIT & VERSION CONTROL · REFERENCE
Setup and Tools
Install Git, choose an editor, and understand the difference between authorship settings and authentication.
At a glance
| Term or command | What it means | When to use it |
|---|---|---|
| git --version | Displays the installed Git version. | Check installation before using other commands. |
| git config | Reads or changes Git settings. | Set your author identity or inspect a setting. |
| --global | Applies a setting to your user account on this computer. | Use for defaults across repositories; omit it inside a repository for project-only settings. |
| Terminal | A place to enter commands. | Use Git Bash, PowerShell, Terminal, or an editor’s integrated terminal. |
| VS Code Source Control | A visual interface to Git operations. | Review changes, stage files, and commit without typing every command. |
| HTTPS / SSH | Ways to connect to an online Git repository. | Use a host-supported credential method for your chosen connection. |
Commands are examples, not an interactive terminal. Run them in your own learning repository after checking the prerequisites. Output, paths, commit IDs, and wording can vary. Host-specific instructions are labeled.
Install and check
Start with Git’s official installation page and choose your operating system. After installation, open a new terminal and run:
git --version
Expect a line beginning with “git version” followed by a number. If the command is not found, restart the terminal, check installation, and confirm Git is on your system path. This guide uses git switch and git restore, which need Git 2.23 or later.
Set default authorship
Replace both example values. These commands change your user-level defaults, not your hosting account.
Commands
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
git config --global --get user.name
Example output
Your Name
Git includes author information in commits. You can override these defaults within a specific repository by repeating the settings without --global.
Sign-in is a separate step
A username and email configured in Git do not log you into GitHub or any other host. Public repositories may allow cloning without sign-in, but pushing normally requires permission and authentication. HTTPS can use a credential manager, browser authorization, or host-supported tokens. SSH uses a key pair whose public key you register with the host.
Do not place passwords, tokens, or private keys in project files or command examples you plan to share. Use the selected host’s current authentication instructions.
Using VS Code or a desktop client
Open the project folder in VS Code and select Source Control. Click a changed file to review its diff; use its stage control to select changes, then enter a message and commit. Confirm that the staged file list matches your intention. “Sync” may combine pulling and pushing, so read its prompts.
GitHub Desktop is another graphical client. A client is the tool you use; a host is where a remote lives. This guide uses terminal commands to show the individual operations clearly.
Sources and further reading
Study questions
Explain it in your own words, then open the answer.
Does user.email log me into a host?
No. It sets commit authorship. Authentication is separate.
When should I omit --global?
Inside a repository when the setting should apply only to that project.
Why open a new terminal after installing?
A new session can pick up updated executable paths.
Is VS Code itself a remote host?
No. It is an editor with interfaces for local Git and remote operations.
What does git --version change?
Nothing; it reports the installed version.