feat: integrate tenant SSO and remote toggle
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
660d5291ec
commit
ca5765b988
27 changed files with 529 additions and 159 deletions
28
scripts/toggle-origin.sh
Executable file
28
scripts/toggle-origin.sh
Executable file
|
|
@ -0,0 +1,28 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
github_url='https://github.com/danyel/go-guess.git'
|
||||
forgejo_url='https://forgejo.dev/exr462/go-guess.git'
|
||||
remote='origin'
|
||||
|
||||
current_url=$(git remote get-url "$remote")
|
||||
case "$current_url" in
|
||||
"$github_url")
|
||||
target_url=$forgejo_url
|
||||
;;
|
||||
"$forgejo_url")
|
||||
target_url=$github_url
|
||||
;;
|
||||
*)
|
||||
printf 'Refusing to change %s: unrecognized URL %s\n' "$remote" "$current_url" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
git remote set-url "$remote" "$target_url"
|
||||
if git config --get-all "remote.$remote.pushurl" >/dev/null; then
|
||||
git config --replace-all "remote.$remote.pushurl" "$target_url"
|
||||
fi
|
||||
|
||||
printf '%s now uses %s\n' "$remote" "$(git remote get-url "$remote")"
|
||||
Loading…
Add table
Add a link
Reference in a new issue