fix(ci): sync remote gitlab

This commit is contained in:
Michael Chris Lopez
2025-03-04 17:00:01 +01:00
parent ce9ef7845d
commit cdb980d814

View File

@@ -18,8 +18,20 @@ jobs:
# Ignore hosts keys, since we accept them as-is
git config --global core.sshCommand 'ssh -i ~/.ssh/id_rsa -o IdentitiesOnly=yes -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
# Codeberg
git remote add codeberg git@codeberg.org:mcchris/zenbones.nvim.git
git remote add codeberg ssh://git@codeberg.org/mcchris/zenbones.nvim.git
git push --tags --force --prune codeberg 'refs/remotes/origin/*:refs/heads/*'
# GitLab
git remote add gitlab git@gitlab.com:mcchris/zenbones.nvim.git
git push --tags --force --prune gitlab 'refs/remotes/origin/*:refs/heads/*'
# NOTE: pushing refs fails with:
# remote: GitLab: You cannot create a branch with an invalid name.
# To ssh://gitlab.com/mcchris/zenbones.nvim.git
# ! [remote rejected] origin/HEAD -> HEAD (pre-receive hook declined)
# ! [remote rejected] origin/dev -> dev (pre-receive hook declined)
git remote add gitlab ssh://git@gitlab.com/mcchris/zenbones.nvim.git
# NOTE: `--all` syncs local branches only
# create tracking braches for all remote branches
for branch in $(git branch --all | grep '^\s*remotes' | grep -vP 'HEAD'); do
git rev-parse --verify "${branch##*/}" 1>/dev/null 2>&1 || \
git branch --track "${branch##*/}" "$branch"
done
git push --force --prune gitlab --all
git push --force gitlab --tags