Update 2025-04-12_12:23:37
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
#!/bin/zsh
|
#!/bin/zsh
|
||||||
# Script Version: 1.3
|
# Script Version: 1.4
|
||||||
# Description: Pushes the current folder (e.g. /etc) to a nested Gitea repo using provided nesting arguments. Auto-creates the remote repo via Gitea API if missing.
|
# Description: Pushes the current folder (e.g. /etc) to a nested Gitea repo using provided nesting arguments. Auto-creates the remote repo via Gitea API if missing.
|
||||||
|
|
||||||
# Set variables
|
# Set variables
|
||||||
@ -13,13 +13,13 @@ fi
|
|||||||
|
|
||||||
GITEA_USER=$(awk '{for(i=1;i<=NF;i++) if($i=="login") print $(i+1)}' ~/.netrc | head -n1)
|
GITEA_USER=$(awk '{for(i=1;i<=NF;i++) if($i=="login") print $(i+1)}' ~/.netrc | head -n1)
|
||||||
if [ -z "$GITEA_USER" ]; then
|
if [ -z "$GITEA_USER" ]; then
|
||||||
log ERROR "No login found in ~/.netrc"
|
echo "[ERROR] No login found in ~/.netrc"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
GITEA_URL="https://$(awk '{for(i=1;i<=NF;i++) if($i=="machine") print $(i+1)}' ~/.netrc | head -n1)"
|
GITEA_URL="https://$(awk '{for(i=1;i<=NF;i++) if($i=="machine") print $(i+1)}' ~/.netrc | head -n1)"
|
||||||
if [ -z "$GITEA_URL" ]; then
|
if [ -z "$GITEA_URL" ]; then
|
||||||
log ERROR "No URL found in ~/.netrc"
|
echo "[ERROR] No URL found in ~/.netrc"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
GITEA_API_URL="$GITEA_URL/api/v1"
|
GITEA_API_URL="$GITEA_URL/api/v1"
|
||||||
@ -149,9 +149,7 @@ REMOTE_PATH="$FOLDER_NAME"
|
|||||||
GIT_REMOTE="$GITEA_URL/$GITEA_USER/$FOLDER_NAME.git"
|
GIT_REMOTE="$GITEA_URL/$GITEA_USER/$FOLDER_NAME.git"
|
||||||
|
|
||||||
# Git authentication hint
|
# Git authentication hint
|
||||||
# export GIT_ASKPASS=true # disabled: does not affect authentication without handler
|
log DEBUG "Ensure ~/.netrc has: machine <host> login $GITEA_USER password <personal access token>"
|
||||||
log DEBUG "Ensure ~/.netrc has:
|
|
||||||
machine gitea.bubuit.net login $GITEA_USER password <personal access token>"
|
|
||||||
|
|
||||||
# Check if GITEA_API_TOKEN is set
|
# Check if GITEA_API_TOKEN is set
|
||||||
if [ -z "$GITEA_API_TOKEN" ]; then
|
if [ -z "$GITEA_API_TOKEN" ]; then
|
||||||
|
Reference in New Issue
Block a user