Extra: Getting Started with GitHub

1. Create a GitHub Account

  • Click "Sign up"

  • Enter your email address

  • Create a password

  • Choose a username

  • Verify your email address

2. Install Git on Your Computer

Windows:

  • Download Git from git-scm.com

  • Run the installer with default settings

  • Open Git Bash to verify the installation: git --version

Mac:

  • Open Terminal

  • Install Homebrew if not installed: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

  • Install Git: brew install git

  • Verify installation: git --version

Linux:

  • Open Terminal

  • For Ubuntu/Debian: sudo apt-get install git

  • For Fedora: sudo dnf install git

  • Verify installation: git --version

3. Configure Git

Open Terminal/Git Bash and run:

git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"

4. Basic GitHub Workflow

Create a New Repository

  1. Click "+" in the top right corner of GitHub

  2. Select "New repository"

  3. Enter repository name

  4. Add description (optional)

  5. Choose public or private

  6. Initialize with README if desired

  7. Click "Create repository"

Clone a Repository

git clone https://github.com/username/repository.git

Basic Git Commands

# Check status of your repository
git status

# Add files to staging area
git add filename    # Add specific file
git add .           # Add all files

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

# Push changes to GitHub
git push origin main

# Pull changes from GitHub
git pull origin main

# Create and switch to a new branch
git checkout -b branch-name

# Switch between branches
git checkout branch-name

5. Best Practices

  • Write clear commit messages

  • Commit often

  • Use branches for new features

  • Keep your repository organized

  • Add a .gitignore file for files you don't want to track

  • Include a README.md with project information

6. Additional Features to Explore

  • Pull Requests

  • Issues

  • GitHub Projects

  • GitHub Pages

  • GitHub Actions

  • Discussions

  • Wiki

7. Troubleshooting

Common Issues:

  1. Authentication failures

    • Ensure your credentials are correct

    • Use SSH keys or personal access tokens for better security

  2. Merge conflicts

    • Pull the latest changes before pushing

    • Resolve conflicts manually when they occur

  3. Permission issues

    • Verify repository access rights

    • Check if you're using the correct remote URL

8. Getting Help

  • GitHub Docs: docs.github.com

  • GitHub Community Forum

  • Stack Overflow

  • GitHub Support

Setting up SSH Authentication for GitHub

1. Check for Existing SSH Keys

First, check if you already have any SSH keys:

ls -al ~/.ssh

2. Generate a New SSH Key

If you don't have an existing key (or want to create a new one):

ssh-keygen -t ed25519 -C "your_email@example.com"
  • Press Enter to accept the default file location

  • Enter a secure passphrase when prompted (recommended)

3. Start the SSH Agent

# Start the ssh-agent in the background
eval "$(ssh-agent -s)"

# Add your SSH private key to the ssh-agent
ssh-add ~/.ssh/id_ed25519

4. Copy the SSH Public Key

On Windows (PowerShell):

Get-Content ~/.ssh/id_ed25519.pub | Set-Clipboard

On Mac:

pbcopy < ~/.ssh/id_ed25519.pub

On Linux:

cat ~/.ssh/id_ed25519.pub

(Then manually copy the output)

5. Add the SSH Key to GitHub

  1. Go to GitHub.com and log in

  2. Click your profile photo → Settings

  3. Click "SSH and GPG keys" in the sidebar

  4. Click "New SSH key"

  5. Give your key a descriptive title (e.g., "Personal Laptop")

  6. Paste your key into the "Key" field

  7. Click "Add SSH key"

6. Test Your SSH Connection

ssh -T git@github.com
  • You should see a message like: "Hi username! You've successfully authenticated..."

7. Update Your Repository Remote URL

If you were using HTTPS before, update to SSH:

# Check current remote
git remote -v

# Update to SSH URL
git remote set-origin git@github.com:username/repository.git

Last updated

Was this helpful?