G
GuideDevOps
Lesson 18 of 18

GitHub / GitLab / Bitbucket

Part of the Git & Version Control tutorial series.

Git Hosting Platforms

Platforms provide cloud hosting for repositories plus collaboration features.

The Big Three

PlatformLaunchedUsersBest For
GitHub2008100M+Open source, popular projects
GitLab201110M+Enterprise, self-hosted
Bitbucket2008EnterpriseTeams using Jira

GitHub

Features

  • Collaborative: Pull requests, code review
  • Social: Stars, following developers
  • Ecosystem: Massive open source community
  • CI/CD: GitHub Actions built-in
  • Permissions: Granular access control

Key Concepts

Repositories:

# Clone from GitHub
git clone https://github.com/user/repository.git

Pull Requests:

  • Propose changes
  • Code review with comments
  • Merge via UI

Issues:

  • Bug tracking
  • Feature requests
  • Project planning

GitHub Actions

Automated workflows (CI/CD):

# .github/workflows/test.yml
name: Tests
on: [push, pull_request]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - run: npm test

GitHub Organizations

For team repositories:

# Organization repo
git clone https://github.com/mycompany/project.git
 
# Team members with roles:
# Owner, Maintainer, Member, Guest

GitLab

Features

  • Self-hosted: Control your own server
  • All-in-one: Project management + CI/CD + security
  • Enterprise: Advanced permissions, audit logs
  • DevOps: Built-in container registry

Key Differences from GitHub

Merge Requests (like PRs):

# Similar workflow but called MR
# More advanced approval rules
# Squash commits option built-in

Runners (like Actions):

# .gitlab-ci.yml
test:
  script:
    - npm test
  runner:
    - docker

Namespaces:

  • Groups (like GitHub Orgs)
  • Better nested structure

Strengths

  • ✅ Self-hosted option
  • ✅ Better for enterprise
  • ✅ More features out-of-box
  • ✅ Container registry included

Bitbucket

Features

  • Jira Integration: Seamless with project management
  • Pipelines: Built-in CI/CD
  • Permissions: Repository-level access control
  • Code insights: Analytics and metrics

When to Use

  • ✅ Already using Jira
  • ✅ Enterprise Atlassian stack
  • ✅ Team of 10-1000 people
  • ❌ Large open source projects
  • ❌ Smaller startups

Comparing Platforms

Cost

PlatformPricingFree Tier
GitHubFree + Pro + Enterprise✅ Unlimited public/private
GitLabFree + Premium + Ultimate✅ 5GB storage
BitbucketFree + Pro + Enterprise✅ $5/user/month

For Open Source

GitHub: Easiest, largest community, most stars

# Get visibility, contributors, stars
# Main platform for open source

For Enterprise

GitLab: Best if self-hosting needed

# Run on your servers
# All company data stays internal

For Teams with Jira

Bitbucket: Seamless integration

# Pull requests link to Jira issues
# Dashboard integrated

Common Workflows Across Platforms

Creating Repository

GitHub:

  1. Dashboard → New Repository
  2. Initialize with README
  3. Clone to computer

GitLab:

  1. Projects → New Project
  2. Blank project or import
  3. Clone to computer

Adding Collaborators

GitHub:

  • Settings → Collaborators
  • Add by username
  • Choose role (Pull/Push/Admin)

GitLab:

  • Project → Members
  • Add user with role
  • Owner/Maintainer/Developer/Guest

Setting Branch Protection

# Prevent pushing directly to main
 
# GitHub:
# Settings → Branches → Main → Add rule
# - Require pull request reviews
# - Require status checks to pass
 
# GitLab:
# Project → Protected branches → Main
# - Require code owner approval
# - Require all discussions resolved

Migration Between Platforms

GitHub to GitLab

# 1. Mirror the repo (keep history)
git clone --mirror https://github.com/user/repo.git
 
# 2. Push to GitLab
cd repo.git
git push --mirror https://gitlab.com/user/repo.git
 
# 3. Clone normally and work
git clone https://gitlab.com/user/repo.git

GitLab to GitHub

# Same process, swap URLs

Community and Ecosystem

GitHub Advantages

  • Largest open source community
  • ✅ Most packages (npm, GitHub Packages)
  • ✅ Easiest to find help
  • ✅ Most integrations
  • ✅ Best for portfolio/resume

GitLab Advantages

  • Can self-host
  • ✅ More features built-in
  • ✅ Better for DevOps teams
  • ✅ All-in-one platform

Bitbucket Advantages

  • Best Jira integration
  • ✅ Enterprise support
  • ✅ Integrated pipelines
  • ✅ Team-focused

Choosing a Platform

Are you on Atlassian stack?
├─ Yes → Bitbucket
└─ No
    Do you need self-hosting?
    ├─ Yes → GitLab
    └─ No
        Building open source?
        ├─ Yes → GitHub
        └─ No → GitHub (most popular)

Best Practices

Repository Settings

  • ✅ Add .gitignore at creation
  • ✅ Add README.md with description
  • ✅ Add LICENSE file
  • ✅ Enable branch protection on main
  • ✅ Require code review before merge
  • ✅ Add CONTRIBUTING guide

Organization

  • ✅ Clear branch naming
  • ✅ Consistent commit messages
  • ✅ Regular code reviews
  • ✅ Automated testing
  • ✅ Automated deployment

Security

  • ✅ Never commit secrets
  • ✅ Use .env for configuration
  • ✅ Review contributor permissions
  • ✅ Enable two-factor authentication
  • ✅ Rotate credentials regularly

Future of Platforms

Trends:

  • AI-assisted: Copilot suggestions
  • Security: Dependency scanning
  • Performance: Container registries
  • Collaboration: Better code review
  • DevOps: Integrated deployment

All platforms converging on similar features.

Tips

✓ GitHub for open source and community
✓ GitLab for self-hosted/enterprise
✓ Bitbucket for Jira teams
✓ Use branch protection rules
✓ Automate testing and deployment
✓ Require code review
✓ Keep README up to date