This commit is contained in:
@@ -74,10 +74,10 @@ jobs:
|
|||||||
if [ -z "$AUTH_TOKEN" ]; then
|
if [ -z "$AUTH_TOKEN" ]; then
|
||||||
git fetch --depth=1 "$SERVER/$REPO.git" "$REF"
|
git fetch --depth=1 "$SERVER/$REPO.git" "$REF"
|
||||||
elif [ "$USE_BASIC_AUTH" = "true" ]; then
|
elif [ "$USE_BASIC_AUTH" = "true" ]; then
|
||||||
# 使用 Basic Auth: https://token:x-oauth-basic@gitea.com/user/repo.git
|
# 使用 Gitea 支持的 Basic Auth: https://x-access-token:token@gitea.domain/user/repo.git
|
||||||
# 去掉 SERVER 中的 https:// 或 http:// 前缀以构建正确的 URL
|
# 去掉 SERVER 中的 https:// 或 http:// 前缀以构建正确的 URL
|
||||||
CLEAN_SERVER=$(echo "$SERVER" | sed -E 's/^\s*.*:\/\///g')
|
CLEAN_SERVER=$(echo "$SERVER" | sed -E 's/^\s*.*:\/\///g')
|
||||||
git fetch --depth=1 "https://$AUTH_TOKEN:x-oauth-basic@$CLEAN_SERVER/$REPO.git" "$REF"
|
git fetch --depth=1 "https://x-access-token:$AUTH_TOKEN@$CLEAN_SERVER/$REPO.git" "$REF"
|
||||||
else
|
else
|
||||||
# 使用 Bearer Token 进行认证
|
# 使用 Bearer Token 进行认证
|
||||||
git -c http.extraHeader="Authorization: Bearer $AUTH_TOKEN" fetch --depth=1 "$SERVER/$REPO.git" "$REF"
|
git -c http.extraHeader="Authorization: Bearer $AUTH_TOKEN" fetch --depth=1 "$SERVER/$REPO.git" "$REF"
|
||||||
|
|||||||
Reference in New Issue
Block a user