Prerequisites
- Windows 11 PC
- Internet or network access to your GitLab self-hosted instance
- Access to your self-hosted GitLab URL from your organization or administrator
- Visual Studio Code (recommended for editing code and working with Git)
Step 1: Download Git
- Open your web browser.
- Go to the official Git website:
- Click Download for Windows.
- The download should start automatically.
Step 2: Install Git
- Double-click the downloaded installer.
- Click Yes if prompted by User Account Control.
- Click Next through the installation wizard.
For most users, the default settings are recommended.
Recommended Installation Options
- Select Components
- Keep the default options selected.
- Click Next.
- Default Editor
- Select Visual Studio Code.
- If Visual Studio Code is not installed, install it first from:
- Click Next.
- Adjust Initial Branch Name
- Choose Override the default branch name for new repositories.
- Enter:
main - Click Next.
- Adjust PATH Environment
- Select:
Git from the command line and also from 3rd-party software - Click Next.
- Select:
- HTTPS Transport Backend
- Leave the default:
Use the OpenSSL library - Click Next.
- Leave the default:
- Line Ending Conversions
- Leave the default:
Checkout Windows-style, commit Unix-style line endings - Click Next.
- Leave the default:
- Terminal Emulator
- Select:
Use MinTTY (the default terminal) - Click Next.
- Select:
- Continue clicking Next until Install appears.
- Click Install.
- Wait for the installation to complete.
- Click Finish.
Step 3: Verify Git Installation
- Open Command Prompt, PowerShell, or the terminal in Visual Studio Code.
- Run:
git --version
Example output:
git version 2.xx.x.windows.x
If you see a version number, Git has been installed successfully.
Step 4: Configure Git
Set your name:
git config --global user.name "Your Name"
Example:
git config --global user.name "John Smith"
Set your email address:
git config --global user.email "your@email.com"
Example:
git config --global user.email "john@email.com"
Step 5: Verify Your Configuration
Run:
git config --list
Example output:
user.name=John Smith
user.email=john@email.com
init.defaultBranch=main
Step 6: Check the Default Branch
Run:
git config --global init.defaultBranch main
This ensures that all newly created repositories use main as the default branch.
Step 7: Access Your Self-Hosted GitLab Instance
- Open your browser.
- Visit the URL provided by your organization or administrator, for example:
https://gitlab.yourcompany.com
- Sign in with your self-hosted GitLab credentials.
- If you do not have an account, contact your GitLab administrator to create one or grant access.
Step 8: Confirm Everything Is Ready
Run these commands:
git --version
git config --list
If both commands work without errors, your Git installation is complete and ready to use with your self-hosted GitLab instance.
Next Tutorial
The next part of this guide will cover:
- Understanding Git and self-hosted GitLab
- Creating your first project in self-hosted GitLab
- Connecting Git to your GitLab server
- Creating repositories
- Cloning repositories
- Making commits
- Pushing changes
- Pulling updates
- Branching and merging
- Resolving merge conflicts
- Best practices
Click Here to view the Next tutorial.
