Installing Git, Configuration Scopes, Identity, Editors, and Credentials: Guided Hands-On Workflow and Core Operations
Install or verify Git using current official platform guidance, trace effective configuration, set an isolated repository identity, test editor/pager behavior, and inspect credential-helper configuration without exposing secrets.
Learning objectives
- Verify which Git executable and exec-path are active on Windows, Linux, or macOS.
- Use official current installation routes and re-check the executable after installation.
- Create a disposable repository and trace configuration origin and scope.
- Set safe repository-local identity and observe it in commit metadata.
- Inspect/test editor, pager, and credential-helper selection without printing secrets.
1. Preflight — do not replace a working installation blindly
First ask what is already installed. A machine can contain several Git distributions, and changing PATH or installers before inspecting them can create a harder problem.
Git Bash, Bash, or zsh
git --version
git --exec-path
command -v git
# Bash/zsh may also show every candidate:
type -a git
PowerShell
git --version
git --exec-path
Get-Command git -All | Select-Object CommandType, Source, Version
where.exe git
2. Current official installation paths
The Git project currently publishes platform-specific install guidance. Use the official page for your operating system because package names and maintained builds can change.
Windows
The official Git install page points to the maintained Git for
Windows build and also documents a winget route:
winget install --id Git.Git -e --source winget
If you use the graphical installer instead, keep a record of choices that affect PATH, terminal integration, credential management, and line endings. The course does not assume Git Bash is your only shell.
macOS
# Homebrew
brew install git
# or Apple's Xcode Command Line Tools
xcode-select --install
MacPorts is another option. Whichever route you choose, verify which
git your shell resolves afterward because
Apple-provided and package-manager versions can coexist.
Linux
# Debian / Ubuntu
sudo apt-get install git
# Fedora
sudo dnf install git
# Arch Linux
sudo pacman -S git
# Alpine
sudo apk add git
Distribution repositories may intentionally ship a Git version different from upstream's newest release. “Latest for this OS release” and “latest upstream” are not always the same requirement.
3. Verify the executable after installation
git --version
git --exec-path
git help -a
git --exec-path reports where Git's core subprograms
are installed. It is not necessarily the same path as the top-level
git executable, so use your shell's command-resolution
tools as well when multiple installations are suspected.
4. Create a disposable repository for configuration experiments
Do not experiment in a real project. Create a new directory and an
explicit initial branch so the lesson does not assume
main or master.
Git Bash, Bash, or zsh
mkdir git-config-lab
cd git-config-lab
git init -b trunk
git status --short --branch
PowerShell
New-Item -ItemType Directory git-config-lab | Out-Null
Set-Location git-config-lab
git init -b trunk
git status --short --branch
Expected observation: the repository is empty, on
trunk, and has no commits. Creating the repository
writes repository-local metadata under .git; it does
not configure your remote credentials.
5. Trace the configuration Git actually sees
git config --list --show-origin --show-scope
git config --show-origin --show-scope --get-regexp '^(user|core|credential|init)\.'
On a clean machine the second command may print little or nothing. On a developer workstation it may reveal global defaults, installer-created settings, included files, or local values.
6. Set identity only in the disposable repository
Repository-local configuration is safer for a lab because it does not change unrelated projects.
git config --local user.name "Config Lab Learner"
git config --local user.email "config-lab@example.invalid"
git config --show-origin --show-scope --get user.name
git config --show-origin --show-scope --get user.email
The .invalid top-level domain is intentionally
non-routable for examples. The values become commit metadata; they
are not login credentials.
7. Make a tiny commit so the identity becomes observable history
printf "configuration lab
" > README.md
git status --short
git add README.md
git diff --staged
git commit -m "Add configuration lab README"
git log -1 --format=fuller
Set-Content README.md 'configuration lab' instead of
printf. The Git commands are otherwise the same.
The fuller log view shows both author and committer
metadata. In an ordinary commit they often match, but Git models
them separately.
8. Configure and test editor selection without depending on one editor
First inspect the effective choice:
git var GIT_EDITOR
For a real workstation, choose an editor that is actually installed.
Examples include code --wait, vim,
nano, or notepad on Windows. Configure it
locally while learning:
git config --local core.editor "code --wait"
git var GIT_EDITOR
If VS Code is not installed or code is not on PATH,
choose a different editor instead of copying this value. To test
safely, run git commit --allow-empty without
-m; your configured editor should open. Save a short
message to create the empty lab commit, or exit/cancel and inspect
git status. Then remove the lab-specific setting if you
do not want it:
git config --local --unset core.editor
9. Understand and test the pager
git var GIT_PAGER
git log --oneline --decorate
git --no-pager log --oneline --decorate
If output seems “stuck” on a screen with a prompt such as
: or (END), a pager such as
less may be active. Press q to quit it.
--no-pager is a safe per-command diagnostic; it does
not rewrite configuration.
10. Inspect credential-helper configuration without revealing credentials
git config --show-origin --show-scope --get-all credential.helper
This query prints helper names/configuration, not stored passwords or tokens. Do not run helper-specific dump commands or paste credential-store files into a troubleshooting log. On Windows, Git Credential Manager is commonly available with Git for Windows; other platforms may use different helpers or none.
credential.helper=store as a
default.
Git's credential documentation labels the plain store helper as
discouraged because it can persist secrets on disk without the
protection of a platform credential manager.
11. Challenge — choose the inspection tool from the symptom
Without copying a sequence, decide which command answers each question:
- “Which Git executable is this shell resolving?”
- “Which file supplied my effective
user.email?” - “What editor will Git launch?”
- “What credential helper names are configured?”
Then verify your answers using command-resolution tools,
git config --show-origin --show-scope,
git var GIT_EDITOR, and a credential-helper config
query.
12. Cleanup
Return to the parent directory, verify the disposable directory name, then remove only the lab. Do not use recursive deletion on a valuable repository.
Git Bash, Bash, or zsh
cd ..
pwd
rm -rf git-config-lab
PowerShell
Set-Location ..
Get-Location
Remove-Item -Recurse -Force git-config-lab
13. Knowledge check
Question 1. Why inspect PATH/command resolution even when
git --version succeeds?
Question 2. What did
git config --local user.email … change?
Question 3. Why is git --no-pager log useful in
diagnostics?
Question 4. Is it safe to print the name of a credential helper?
14. Summary
Installation is complete only when you know which executable runs. Configuration is trustworthy only when you can trace its origin/scope. Identity is safe only when you distinguish metadata from authentication, and editor/pager/helper behavior is predictable only when you can identify the external tool Git will invoke.
Authoritative references
Install Git on Windows
Install Git on macOS
Install Git on Linux
git-config
gitcredentials
Keep the academy open
Support free, practical DevOps education.
Every lesson is designed to remain readable in a browser, downloadable from GitHub, and usable without a paid learning platform. Contributions help expand and maintain the curriculum.
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0
Send only Ethereum/ERC-20 compatible assets to this
address.