Moving My Portfolio from GitHub to GitLab

My portfolio lived on GitHub. I wanted it next to the rest of my projects on GitLab, without losing the GitHub copy and without leaving an access token lying around in plain text.
Keep both remotes
You don’t have to pick one. Rename the old remote and add the new one as origin:
git remote rename origin github
git remote add origin https://gitlab.com/<user>/portfolio.git
git push -u origin main
Plain git push now goes to GitLab, and git push github main still updates the old repo.
Don’t put the token in the URL
The quick way to push with a personal access token is https://oauth2:<token>@gitlab.com/.... It works, but the token ends up in .git/config, in shell history, and sometimes in error messages.
Pass it as a one-off HTTP header instead. Nothing gets written to disk:
TOKEN=$(cat ~/.secrets/gitlab-token)
git -c http.extraheader="Authorization: Basic $(printf 'oauth2:%s' "$TOKEN" | base64 -w0)" \
push -u origin main
-c sets the config value for that one command only, and the remote URL stays clean.
Skip CI when minutes are tight
The free tier’s pipeline minutes run out faster than you’d think. If a push doesn’t need a pipeline, tell GitLab so:
git push -o ci.skip origin main
Or put [skip ci] in the commit message. Either way the push lands and no runner spins up.
Clean up while you’re there
Moving is a good excuse to check what you actually track. My working tree showed 132 changes, and 131 of them were generated folders from local tools. Two lines in .gitignore fixed that, which beat recloning and losing them.