GitHub’s new dashboard became the default and the automatic repository list on the profile page went with it. The replacement is manual — you pin up to 25 favourites yourself. Separately, I found out that GitLab’s GitHub importer creates a new copy of a project on re-import rather than updating it, so it cannot be used as a mirror on the Free tier.

So I wrote gh2gl.sh: 846 lines of bash that compare refs on both sides and force-push only what differs.

What GitHub changed

DateChangeEffect
Feb 24, 2026Repository dashboard generally availablegithub.com/repos becomes a first-class place to find, filter and save views of your repositories
Nov 10, 2026A more informative GitHub dashboard“Since the new dashboard experience became the default…” — compact layout, six PRs/issues instead of three, Feed/Home pinnable as default
Nov 20, 2026Pin your favorite repositories to your dashboardNew Favorite repositories section: Edit → Add repositories → select → Save. Synced with GitHub Mobile’s pinned repositories. Limit: 25

Feedback thread: New dashboard is now the default experience.

No entry is titled “we removed your repository list”, because that is not what happened. The dashboard became the default and the list became something you curate instead of inherit.

Why GitLab’s importer is not a mirror

GitLab’s GitHub importer is a one-shot snapshot:

Completed imports can be re-imported by selecting Re-import and specifying a new name. This creates a new copy of the source project.

A new project, not an update. The two sides then drift apart permanently. The alternatives are all off the table on the Free tier:

OptionTierBehaviour
Import from GitHubFreeOne-shot copy. Never updates.
Sync the repositories you importPremium, Ultimate (Experiment)Continuous GitHub → GitLab sync. The GitLab project is read-only while it runs.
Pull mirroring (GitHub → GitLab)Premium, UltimateBranches, tags and commits pulled on a schedule. Not writable. Updates floored at 5 minutes; GitLab stops updating a diverged branch unless Overwrite diverged branches is enabled.
Push mirroring (GitLab → GitHub)FreeWrong direction.

Free tier gets the importer only, so the choice is: pay for pull mirroring, or write it.

Design

Four rules:

  • GitHub is the source of truth. GitLab is overwritten, never merged.
  • Nothing is pushed unless a ref differs.
  • Every push is verified afterwards.
  • Missing GitLab projects are created, with the right visibility.

Compare refs, not history

A SHA is the identity of a commit, so git ls-remote is enough to decide whether a repository is out of date. No clone is needed.

# `comm` compares whole lines, so both lists must use plain `sort` order.
gh_refs="$(printf '%s\n%s\n' "$gh_branches" "$gh_tags" | grep -v '^$' | sort)"
gl_refs="$(printf '%s\n%s\n' "$gl_branches" "$gl_tags" | grep -v '^$' | sort)"
missing_refs="$(comm -23 <(printf '%s\n' "$gh_refs") <(printf '%s\n' "$gl_refs") 2>/dev/null)"
extra_refs="$(comm -13 <(printf '%s\n' "$gh_refs") <(printf '%s\n' "$gl_refs") 2>/dev/null)"

missing_refs is every GitHub ref that GitLab either lacks or holds at a different SHA — the exact set to push. extra_refs is the inverse, and only matters when pruning is on.

if [ "$project_exists" -eq 0 ]; then
  changed=1; reason="no GitLab project"
else
  if [ -n "$missing_refs" ]; then
    changed=1; reason="$(printf '%s' "$missing_refs" | wc -l | tr -d ' ') ref(s) missing or different"
  elif { [ -n "$extra_prunable" ] && [ "$PRUNE_BRANCHES" -eq 1 ]; } || { [ -n "$extra_prunable_tags" ] && [ "$PRUNE_TAGS" -eq 1 ]; }; then
    changed=1; reason="extra GitLab branch(es) to prune"
  elif [ "$FORCE" -eq 1 ]; then
    changed=1; reason="forced"
  fi
fi

No commit-message comparison, no author check, no “changed in the last N days” heuristic. If the refs differ, push.

Push

Force-push of every branch and tag. --prune deletes GitLab branches absent from GitHub, so it is disabled when GitHub’s default branch does not exist under that name on GitHub — GitLab refuses to delete the default branch anyway, and the failure is opaque.

local push_args=(--force)
local gl_head_branch prune_branches="$PRUNE_BRANCHES"
gl_head_branch="$(gl_ls_remote_symref "$repo")"
if [ -n "$gl_head_branch" ] && ! printf '%s\n' "$gh_branches" | awk -v r="refs/heads/$gl_head_branch" '$2==r {found=1} END{exit !found}'; then
  prune_branches=0
  warn "not pruning $repo: GitLab default branch '$gl_head_branch' does not exist on GitHub"
fi
[ "$prune_branches" -eq 1 ] && push_args+=(--prune)
[ "$PRUNE_TAGS" -eq 1 ] && push_args+=(--prune-tags)
push_args+=(gitlab 'refs/heads/*:refs/heads/*' 'refs/tags/*:refs/tags/*')

Protected branch: GitLab refuses the force-push. The script detects the refusal, retries as a fast-forward push of the other branches, and — with a GITLAB_TOKEN — unprotects the branch through the API and retries. Otherwise it reports the error rather than a false success.

Verify

The same set difference, re-run after the push. Anything still missing is an error, not an update.

gl_ls="$(gl_ls_remote "$repo")"
gl_branches="$(printf '%s\n' "$gl_ls" | awk '$2 ~ /^refs\/heads\// {print $1" "$2}' | sort -k2)"
gl_tags="$(printf '%s\n' "$gl_ls" | awk '$2 ~ /^refs\/tags\// && $2 !~ /\^\{\}$/ {print $1" "$2}' | sort -k2)"
gl_refs="$(printf '%s\n%s\n' "$gl_branches" "$gl_tags" | grep -v '^$' | sort)"
missing_refs="$(comm -23 <(printf '%s\n' "$gh_refs") <(printf '%s\n' "$gl_refs") 2>/dev/null)"
if [ -n "$missing_refs" ]; then
  printf 'error|verification failed for %s (still differs)\n' "$repo" > "$result"
  ...

Other behaviour

  • Transport: SSH preferred, HTTPS with token as fallback. Tokens go through the environment and a GIT_ASKPASS helper, never argv, so they never appear in ps.
  • Token: only needed to create projects and set visibility. Pushing is SSH-only.
  • Private repositories: --private-as mirror|public|private|skip, default mirror (private).
  • Filtering: --only, --skip, --no-forks, --no-archived.
  • Pruning: branches on by default (--no-prune to disable), tags only with --prune-tags.
  • Parallelism: 6 repositories by default (--jobs).
  • Cache: ~/.cache/gh2gl holds the local mirrors.

Usage

./gh2gl.sh              # sync everything
./gh2gl.sh --dry-run    # report only, change nothing
./gh2gl.sh --check      # report only, exit 3 on drift (for CI)
./gh2gl.sh --only repo  # subset

Exit codes: 0 success, 1 errors occurred, 2 bad usage, 3 differences found (--check).

All flags are documented in the README.

Limitations

  • One-way. A commit that exists only in GitLab is never pushed back, and the next run force-pushes over it.
  • Code only. Branches, tags and LFS objects. Not issues, merge requests, comments, releases or labels.
  • Not a backup. It mirrors whatever GitHub currently says, so it does not survive the loss of the GitHub account.
  • Pruning is destructive by default on GitLab branches that no longer exist on GitHub.