Update 2025-04-12_12:23:37
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
#!/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.
|
||||
|
||||
# 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)
|
||||
if [ -z "$GITEA_USER" ]; then
|
||||
log ERROR "No login found in ~/.netrc"
|
||||
echo "[ERROR] No login found in ~/.netrc"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
GITEA_URL="https://$(awk '{for(i=1;i<=NF;i++) if($i=="machine") print $(i+1)}' ~/.netrc | head -n1)"
|
||||
if [ -z "$GITEA_URL" ]; then
|
||||
log ERROR "No URL found in ~/.netrc"
|
||||
echo "[ERROR] No URL found in ~/.netrc"
|
||||
exit 1
|
||||
fi
|
||||
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 authentication hint
|
||||
# export GIT_ASKPASS=true # disabled: does not affect authentication without handler
|
||||
log DEBUG "Ensure ~/.netrc has:
|
||||
machine gitea.bubuit.net login $GITEA_USER password <personal access token>"
|
||||
log DEBUG "Ensure ~/.netrc has: machine <host> login $GITEA_USER password <personal access token>"
|
||||
|
||||
# Check if GITEA_API_TOKEN is set
|
||||
if [ -z "$GITEA_API_TOKEN" ]; then
|
||||
|
Reference in New Issue
Block a user