Skip to content

Renaming Default Branch from master to main

Status

Completed - Local branches have been renamed and pushed. GitHub default branch settings updated.

What Was Done

  1. ✅ Renamed local branch: git branch -m master main
  2. ✅ Pushed new main branch: git push -u origin main
  3. ✅ Completed for both repositories:
  4. cluster-gitops
  5. camarades-infrastructure

Manual Steps Required on GitHub

For cluster-gitops repository:

  1. Go to: https://github.com/camaradesuk/cluster-gitops/settings/branches
  2. Under "Default branch", click the switch icon (↔️) next to "master"
  3. Select "main" from the dropdown
  4. Click "Update"
  5. Confirm the change

For camarades-infrastructure repository:

  1. Go to: https://github.com/camaradesuk/camarades-infrastructure/settings/branches
  2. Under "Default branch", click the switch icon (↔️) next to "master"
  3. Select "main" from the dropdown
  4. Click "Update"
  5. Confirm the change

After Changing Default Branch

Delete the old master branch from both repositories:

# For cluster-gitops
cd /home/chris/workspace/syrf/cluster-gitops
git push origin --delete master

# For camarades-infrastructure
cd /home/chris/workspace/syrf/camarades-infrastructure
git push origin --delete master

ArgoCD Impact

ArgoCD ApplicationSets are already configured to use main branch: - targetRevision: main in all ApplicationSets - No changes needed to ArgoCD configuration

Once the default branch is changed on GitHub, ArgoCD will automatically: 1. Resolve main branch correctly 2. Start generating Applications from ApplicationSets 3. Deploy infrastructure and SyRF services

Verification

After completing GitHub changes, verify ArgoCD can resolve the branch:

# Trigger hard refresh of root Application
kubectl annotate application root -n argocd argocd.argoproj.io/refresh=hard --overwrite

# Wait 15 seconds and check ApplicationSet controller logs
sleep 15
kubectl logs -n argocd deployment/argocd-applicationset-controller --tail=20

# Should see successful generation, not "unable to resolve 'main'"

Other Repositories

The main syrf monorepo also uses master. You may want to rename it too:

cd /home/chris/workspace/syrf
git branch -m master main
git push -u origin main
# Then change default branch on GitHub
# Then delete old master: git push origin --delete master