Remote Work Tools

Migrating from AWS CodeCommit to GitHub for Remote Team Code Hosting Guide

Remote teams increasingly need collaboration features that AWS CodeCommit cannot fully provide. While CodeCommit served many organizations well, GitHub’s pull request workflows, Actions automation, and ecosystem integrations make it a stronger choice for distributed development teams. This guide walks through the migration process with practical commands and configuration examples you can apply immediately.

Why Remote Teams Choose GitHub Over CodeCommit

CodeCommit offers secure Git hosting within AWS, but remote teams often encounter friction with its limited collaboration features. GitHub provides code review tools, project management boards, and a marketplace of integrations that remote teams rely on for async communication.

The primary motivations for migration typically include: better pull request diffs and review tools, native CI/CD with GitHub Actions, simpler team permission management, and easier onboarding for developers familiar with GitHub’s interface. For teams spread across time zones, these features significantly reduce coordination overhead.

Pre-Migration Preparation

Before executing the migration, audit your current CodeCommit repository structure and identify all branches, tags, and collaborators.

# List all CodeCommit repositories in your AWS account
aws codecommit list-repositories --region us-east-1

# Get repository details including branch information
aws codecommit get-repository --repository-name your-repo-name --region us-east-1

# List all branches in a repository
aws codecommit list-branches --repository-name your-repo-name --region us-east-1

Document your existing IAM users and their CodeCommit permissions. You’ll need to recreate these access configurations in GitHub, either through organization members, teams, or outside collaborators.

Migration Strategy: Mirror Git Repositories

The most reliable migration method involves mirroring your entire Git history from CodeCommit to GitHub. This preserves all commits, branches, tags, and commit messages without losing history.

Step 1: Clone CodeCommit Repository Locally

First, configure Git to work with CodeCommit credentials. If you’re using AWS CLI v2, it handles authentication automatically with the default credential chain.

# Clone the CodeCommit repository with all branches
git clone https://git-codecommit.us-east-1.amazonaws.com/v1/repos/your-repo-name

cd your-repo-name

Step 2: Create GitHub Repository

Create your target repository on GitHub, either through the web interface or CLI:

# Using GitHub CLI (gh)
gh repo create your-org/your-repo-name --private --source=. --push

For private team repositories, adjust the visibility as needed. GitHub’s free organization tier includes unlimited collaborators on private repositories, a significant improvement over CodeCommit’s tiered pricing.

Step 3: Push All Branches and Tags

Push your entire repository history to GitHub:

# Add the new remote
git remote add github git@github.com:your-org/your-repo-name.git

# Push all branches
git push github --all

# Push all tags
git push github --tags

This approach preserves your complete Git history, including all branches that developers may have been working on. Verify the push completed successfully before proceeding.

Updating Developer Workflows

After migration, your team needs to update their local Git configurations. Provide clear documentation for developers to switch their remotes.

Developer Migration Script

Create a simple script your team can run:

#!/bin/bash
# migrate-remotes.sh

echo "Updating git remote from CodeCommit to GitHub..."

# Check current remotes
git remote -v

# Change the remote URL
git remote set-url origin git@github.com:your-org/your-repo-name.git

# Verify the change
git remote -v

# Fetch any remaining remote updates
git fetch origin

echo "Remote updated successfully!"
echo "Run 'git pull' to sync with the new remote."

Updating SSH Keys

CodeCommit uses AWS IAM-managed credentials or git-remote-codecommit. GitHub uses SSH keys or personal access tokens (PATs). Ensure developers configure their GitHub authentication before pushing:

# Test GitHub SSH connection
ssh -T git@github.com

# Configure git to use SSH for GitHub
git config --global url."git@github.com:".insteadOf "https://github.com/"

Handling AWS-Specific Integrations

Many CodeCommit repositories integrate with AWS services. You’ll need to update these integrations to work with GitHub.

Updating CI/CD Pipelines

If you use AWS CodePipeline or CodeBuild, migrate to GitHub Actions or a similar CI/CD system:

# .github/workflows/ci.yml
name: CI

on:
  push:
    branches: [ main, develop ]
  pull_request:
    branches: [ main ]

jobs:
  build:
    runs-on: ubuntu-latest
    
    steps:
    - uses: actions/checkout@v4
    
    - name: Setup Node.js
      uses: actions/setup-node@v4
      with:
        node-version: '20'
        cache: 'npm'
    
    - name: Install dependencies
      run: npm ci
    
    - name: Run tests
      run: npm test
    
    - name: Build
      run: npm run build

For teams using AWS-specific tools like SAM or CDK, GitHub Actions can still deploy to AWS using OIDC federation, eliminating the need for long-lived AWS credentials.

Secrets Management Transition

CodeCommit users often store credentials in AWS Secrets Manager or Systems Manager Parameter Store. GitHub provides encrypted secrets at the repository or organization level:

# Add secrets via GitHub CLI
gh secret set AWS_ACCESS_KEY_ID --body "$AWS_ACCESS_KEY_ID"
gh secret set AWS_SECRET_ACCESS_KEY --body "$AWS_SECRET_ACCESS_KEY"

Preserving Code Review History

One limitation of Git mirroring is that CodeCommit pull request comments and approvals don’t transfer automatically. Document any critical review decisions before migration:

# Export CodeCommit pull request comments (requires scripting)
aws codecommit get-pull-request --pull-request-id PR_ID --region us-east-1

Create a documentation page in your new GitHub repository summarizing any open review items that need attention after migration.

Post-Migration Checklist

Verify the migration completed successfully with this verification process:

  1. Branch verification: Confirm all branches exist in GitHub
    git ls-remote --heads github
    
  2. Tag verification: Ensure all tags transferred
    git ls-remote --tags github
    
  3. Commit history: Spot-check commit counts match
    # CodeCommit
    git rev-list --all --count
       
    # GitHub
    gh api repos/your-org/your-repo-name/stats/commit --jq '.[] | select(.total != null) | .total'
    
  4. Team access: Verify all developers can clone and push to the new repository

  5. CI/CD status: Confirm automated tests and deployments function correctly

Conclusion

Migrating from CodeCommit to GitHub requires planning but follows a straightforward process. The key steps involve mirroring your Git history, updating developer workflows, reconfiguring CI/CD pipelines, and verifying access permissions. For remote teams, GitHub’s collaboration features and integration ecosystem provide substantial improvements in developer productivity and async communication.

The initial migration effort pays dividends through better code review experiences, simpler permission management, and access to the broader GitHub ecosystem. Start with a small repository to validate your migration process, then scale to your full repository portfolio.

Built by theluckystrike — More at zovo.one