Skip to main content

Git and GitHub Setup Journey

1. Creating a GitHub Account

Why GitHub?

GitHub is more than just a platform - it's a collaborative ecosystem for developers worldwide. It allows you to store, manage, and share code, track changes, and work with teams seamlessly.

Account Creation Steps

  1. Navigate to https://github.com/signup
  2. Choose your account type (typically "Personal")
  3. Select options that reflect your development goals
    • Are you a student? Professional? Open-source contributor?
  4. Complete the registration process
    • Use a professional email you'll remember
    • Create a strong, unique password
Account Creation Advice
  • Use an email you'll consistently access
  • Choose a username that represents your professional identity
  • Consider using the same username across professional platforms

2. Organization Invitation Preparation

Communicating with Sean

  1. Have your GitHub username ready
  2. Prepare a professional email message:
    Good Morning Sean,

    I've created my GitHub account with the username [YOUR_USERNAME]
    and would like to be added to the TravellingLanguages organization.
    My professional email is [YOUR_EMAIL].

    Could you please send me an invitation?

    Best regards,
    [Your Name]
  3. send it to sf@tl.ie

Verifying Organization Access

  1. Visit https://github.com/settings/organizations
  2. Look for "TravellingLanguages" in your organization list
  3. Alternative verification: https://github.com/TravellingLanguages
Organization Invitation
  • Wait for Sean to send the invitation
  • Accept the invitation through the email link
  • Confirm your membership in the organization

3. Git Installation

Understanding Git

Git is a distributed version control system that tracks changes in source code during software development. It allows multiple developers to work together efficiently.

Installation by Operating System

Windows: Multiple Installation Methods

Method 1: Browser Download
  1. Visit https://git-scm.com/download/win
  2. Download the installer
  3. Run the installer
  4. Choose "Use Git Bash" during installation
  5. Select "Recommended" settings for most options
Method 2: Command-Line Download using wget

If you prefer downloading directly via command line, follow these steps:

  1. Open PowerShell as Administrator

    • Press Windows Key
    • Type "PowerShell"
    • Right-click and select "Run as Administrator"
  2. Download Git Installer

    # Download 64-bit version
    Invoke-WebRequest -Uri "https://github.com/git-for-windows/git/releases/download/v2.43.0.windows.1/Git-2.43.0-64-bit.exe" -OutFile "GitInstaller.exe"
  3. Verify Download Integrity

    # Optional: Check file size to confirm download
    (Get-Item "GitInstaller.exe").length
  4. Install Git

    # Silent install (recommended for automated setups)
    Start-Process -FilePath ".\GitInstaller.exe" -ArgumentList "/SILENT" -Wait
  5. Verify Installation

    # Check Git version
    git --version
Download Considerations
  • Always download from official sources
  • Verify the exact version number at the time of installation
  • 64-bit version recommended for most modern systems
Method 3: Chocolatey Package Manager (Alternative)

For those using Chocolatey:

choco install git

macOS

  1. Install via Homebrew:
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    brew install git

Linux (Ubuntu/Debian)

sudo apt update
sudo apt install git

Verifying Installation

git --version

4. GitHub CLI Authentication: A Deep Dive

Prerequisites

  • Git installed
  • GitHub account
  • GitHub CLI installed

Installation of GitHub CLI

Windows

  1. Download from https://cli.github.com/
  2. Run the installer
  3. Follow installation wizard

macOS

brew install gh

Linux

# Ubuntu/Debian
sudo apt install gh

# Fedora
sudo dnf install gh

Authentication Process: The Comprehensive Walkthrough

Step 1: Initial Authentication

gh auth login

Interactive Prompt Breakdown

When you run gh auth login, you'll encounter an interactive wizard:

  1. Host Selection

    • Choose "GitHub.com"
    • This connects to the main GitHub platform
  2. You may be prompted this: Authenticate Git with your GitHub credentials? (Y/n)

    • Choose "Y" to authenticate Git with your GitHub credentials
  3. Authentication Method

    • Select "Web Browser" (recommended)
    • Provides the most secure and user-friendly experience
  4. Browser-Based Authentication

    • A browser window will open
    • You'll see a unique code
    • GitHub will ask you to enter this code
    • Confirm your login
  5. Scope Selection

    • Choose "Entire account access"
    • This allows full repository interactions

Verification

# Verify successful authentication
gh auth status
Authentication Troubleshooting
  • Ensure pop-ups are enabled
  • Check internet connectivity
  • Refresh browser if code doesn't work

5. Git CLI: Essential Commands Tutorial

Basic Workflow Commands

Configuring Your Identity

# Set your username
git config --global user.name "Your Name"

# Set your email
git config --global user.email "your.email.used.for.github@example.com"

Repository Operations

# Create a new repository
git init

# Clone an existing repository
git clone https://github.com/username/repository.git

# Check repository status
git status

Tracking Changes

# Add files to staging
git add filename.txt # Single file
git add . # All changes

# Commit changes
git commit -m "Descriptive commit message"

Branching

# Create a new branch
git branch new-feature

# Switch to a branch
git checkout new-feature

# Create and switch in one command
git checkout -b another-feature

Synchronizing

# Pull latest changes
git pull origin main

# Push your changes
git push origin your-branch-name

Best Practices and Recommendations

  1. Always pull before you push
  2. Write clear, descriptive commit messages
  3. Use branches for new features
  4. Regularly update your local repositories
  5. Never commit sensitive information
Security Alert
  • Never commit passwords or sensitive data
  • Use .gitignore to prevent accidental commits
  • Be mindful of what you're pushing

Conclusion

This is a basic guide to setting up Git and GitHub for your development journey. Remember, practice makes perfect, so keep experimenting and learning. Happy coding!

if you wan a deeper dive into git and github, check out the following resources:

Deep Dive