Skip to content

Commit cdb980d

Browse files
committed
fix(ci): sync remote gitlab
1 parent ce9ef78 commit cdb980d

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

.github/workflows/sync_remote.yml

+15-3
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,20 @@ jobs:
1818
# Ignore hosts keys, since we accept them as-is
1919
git config --global core.sshCommand 'ssh -i ~/.ssh/id_rsa -o IdentitiesOnly=yes -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'
2020
# Codeberg
21-
git remote add codeberg [email protected]:mcchris/zenbones.nvim.git
21+
git remote add codeberg ssh://[email protected]/mcchris/zenbones.nvim.git
2222
git push --tags --force --prune codeberg 'refs/remotes/origin/*:refs/heads/*'
2323
# GitLab
24-
git remote add gitlab [email protected]:mcchris/zenbones.nvim.git
25-
git push --tags --force --prune gitlab 'refs/remotes/origin/*:refs/heads/*'
24+
# NOTE: pushing refs fails with:
25+
# remote: GitLab: You cannot create a branch with an invalid name.
26+
# To ssh://gitlab.com/mcchris/zenbones.nvim.git
27+
# ! [remote rejected] origin/HEAD -> HEAD (pre-receive hook declined)
28+
# ! [remote rejected] origin/dev -> dev (pre-receive hook declined)
29+
git remote add gitlab ssh://[email protected]/mcchris/zenbones.nvim.git
30+
# NOTE: `--all` syncs local branches only
31+
# create tracking braches for all remote branches
32+
for branch in $(git branch --all | grep '^\s*remotes' | grep -vP 'HEAD'); do
33+
git rev-parse --verify "${branch##*/}" 1>/dev/null 2>&1 || \
34+
git branch --track "${branch##*/}" "$branch"
35+
done
36+
git push --force --prune gitlab --all
37+
git push --force gitlab --tags

0 commit comments

Comments
 (0)