Skip to main content

Step 2: Git & Version Control

Time: 5 minutes
Purpose: Install and configure Git for source code management

Company-Specific Setup

If you're a company employee, complete the Ybor Employee Onboarding first for organization access and SSH key setup specific to company requirements.

Install Git

Installation: Follow the official guide at git-scm.com/downloads

PlatformInstallation MethodOfficial Documentation
macOSXcode Command Line Tools or Homebrewgit-scm.com/download/mac
WindowsGit for Windows or Chocolateygit-scm.com/download/win
LinuxPackage managergit-scm.com/download/linux

Quick Install Commands

# macOS
xcode-select --install # Includes Git (built-in)
brew install git # Latest version via Homebrew

# Windows (PowerShell 7 as Administrator)
choco install git -y

# Linux
sudo apt install git # Ubuntu/Debian
sudo dnf install git # Fedora/RHEL
sudo yum install git # Older CentOS/RHEL

Configure Git

# Set your name and email (replace with your actual info)
git config --global user.name "Your Full Name"
git config --global user.email "your.email@example.com"

# Optional: Set default branch name
git config --global init.defaultBranch main

# Optional: Set preferred editor
git config --global core.editor "code --wait" # For VS Code
# Generate SSH key for secure Git access
ssh-keygen -t ed25519 -C "your.email@example.com"

# Add to SSH agent
ssh-add ~/.ssh/id_ed25519

# Copy public key to clipboard
# macOS
pbcopy < ~/.ssh/id_ed25519.pub

# Windows (PowerShell 7)
Get-Content ~/.ssh/id_ed25519.pub | Set-Clipboard

# Linux
cat ~/.ssh/id_ed25519.pub | xclip -selection clipboard

Note: You'll need to add this SSH key to your Git provider (GitHub, GitLab, etc.) in their SSH settings.

SSH Config for Multiple Keys (Advanced)

If you work with multiple Git accounts or need different SSH keys for different repositories:

Create SSH Config

Create or edit ~/.ssh/config:

# Work GitHub
Host github.com
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519
IdentitiesOnly yes

# Personal GitHub
Host github-personal
HostName github.com
User git
IdentityFile ~/.ssh/id_ed25519_personal
IdentitiesOnly yes

# GitLab
Host gitlab.com
HostName gitlab.com
User git
IdentityFile ~/.ssh/id_ed25519_gitlab
IdentitiesOnly yes

Generate Additional Keys (if needed)

# Generate personal key
ssh-keygen -t ed25519 -C "your.personal@email.com" -f ~/.ssh/id_ed25519_personal

# Generate GitLab key
ssh-keygen -t ed25519 -C "your.email@example.com" -f ~/.ssh/id_ed25519_gitlab

# Add all keys to SSH agent
ssh-add ~/.ssh/id_ed25519
ssh-add ~/.ssh/id_ed25519_personal
ssh-add ~/.ssh/id_ed25519_gitlab

Usage with Multiple Hosts

# Clone from work GitHub (uses default config)
git clone git@github.com:company-org/repo.git

# Clone from personal GitHub (uses personal config)
git clone git@github-personal:your-username/personal-repo.git

# Clone from GitLab
git clone git@gitlab.com:username/repo.git

Verification

# Check Git version
git --version

# Verify configuration
git config --get user.name
git config --get user.email

# Test SSH key (if created)
ssh-add -l # Should show your key(s)

# Test GitHub SSH connection (if using GitHub)
ssh -T git@github.com # Should authenticate successfully

Expected GitHub SSH response:

Hi <your-username>! You've successfully authenticated, but GitHub does not provide shell access.

Next Step

Step 3: System Libraries