Skip to content

Scheduling infrastructure for absolutely everyone.

Support both https/git by detection of origin root (#6651)

Alex van Andela888be6e0489
diff --git a/git-init.sh b/git-init.sh
index 0fb7890985b..045c1346817 100755
--- a/git-init.sh
+++ b/git-init.sh
@@ -1,7 +1,7 @@
#!/bin/sh
-# If there's a `.gitmodule` file skip this script
+# Skip if `.gitmodules` exists
[ -f .gitmodules ] && {
- echo ".gitmodules already initializied"
+ echo ".gitmodules already initialized"
exit 0
}
diff --git a/git-setup.sh b/git-setup.sh
index 0d1daac1f53..5f8b7820584 100755
--- a/git-setup.sh
+++ b/git-setup.sh
@@ -5,11 +5,13 @@ if [ $# -eq 0 ]; then
echo "Usage: git-setup.sh <api,console,website>"
exit 1
fi
+# Get remote url to support either https or ssh
+remote_url=$(echo $(git config --get remote.origin.url) | sed 's![^/]*$!!')
# Loop through the requested modules
for module in "$@"; do
echo "Setting up '$module' module..."
# Set the project git URL
- project=$(echo "[email protected]:calcom/$module.git")
+ project=$remote_url$module.git
# Check if we have access to the module
if [ "$(git ls-remote "$project" 2>/dev/null)" ]; then
echo "You have access to '${module}'"
@@ -18,7 +20,7 @@ for module in "$@"; do
# Prevents duplicate entries
git config -f .gitmodules --unset-all "submodule.apps/$module.branch"
# Add the submodule
- git submodule add --force "[email protected]:calcom/$module.git" "apps/$module"
+ git submodule add --force $project "apps/$module"
# Set the default branch to main
git config -f .gitmodules --add "submodule.apps/$module.branch" main
# Adding the subdmoule ignores the `.gitignore` so a reset is needed