Skip to content

Commit 29ddf92

Browse files
committed
fix: fix ssh errors
1 parent a87627a commit 29ddf92

3 files changed

Lines changed: 24 additions & 4 deletions

File tree

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[submodule "apps/web/src/content/newsletters-premium"]
22
path = apps/web/src/content/newsletters-premium
3-
url = git@github.com:apsinghdev/opensox-newsletters-premium.git
3+
url = https://github.com/apsinghdev/opensox-newsletters-premium.git

apps/web/scripts/init-submodules.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,22 @@
33

44
set -e # Exit immediately on any error
55

6-
# setup ssh for private submodule
7-
if [ -n "$GIT_SSH_KEY" ]; then
6+
# Use HTTPS with token if available, otherwise try SSH
7+
if [ -n "$GITHUB_TOKEN" ]; then
8+
# Configure git to use token for HTTPS
9+
# This allows access to private repositories without SSH setup
10+
git config --global url."https://${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/"
11+
git config --global url."https://${GITHUB_TOKEN}@github.com/".insteadOf "git@github.com:"
12+
echo "Configured git to use GitHub token for private repository access"
13+
elif [ -n "$GIT_SSH_KEY" ]; then
14+
# Fallback to SSH if token is not available
815
mkdir -p ~/.ssh || { echo "Failed to create ~/.ssh directory" >&2; exit 1; }
916
printf '%s' "$GIT_SSH_KEY" > ~/.ssh/id_ed25519 || { echo "Failed to write SSH key" >&2; exit 1; }
1017
chmod 600 ~/.ssh/id_ed25519 || { echo "Failed to set SSH key permissions" >&2; exit 1; }
1118
ssh-keyscan -t ed25519 github.com >> ~/.ssh/known_hosts 2>/dev/null || true
19+
echo "Configured SSH for private repository access"
20+
else
21+
echo "Warning: No GITHUB_TOKEN or GIT_SSH_KEY found. Private submodule may fail to clone." >&2
1222
fi
1323

1424
# initialize and update submodules

turbo.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,17 @@
55
"build": {
66
"dependsOn": ["^build"],
77
"inputs": ["$TURBO_DEFAULT$", ".env*"],
8-
"outputs": [".next/**", "!.next/cache/**", "dist/**"]
8+
"outputs": [".next/**", "!.next/cache/**", "dist/**"],
9+
"env": [
10+
"GITHUB_TOKEN",
11+
"GIT_SSH_KEY",
12+
"NEXTAUTH_SECRET",
13+
"GOOGLE_CLIENT_ID",
14+
"GOOGLE_CLIENT_SECRET",
15+
"NEXTAUTH_URL",
16+
"GITHUB_CLIENT_ID",
17+
"GITHUB_CLIENT_SECRET"
18+
]
919
},
1020
"lint": {
1121
"dependsOn": ["^lint"]

0 commit comments

Comments
 (0)