From 969808a82bef7ff0cccca296c5c3a32d7a1577c9 Mon Sep 17 00:00:00 2001 From: Staubgeborener Date: Wed, 20 Nov 2024 21:15:58 +0100 Subject: [PATCH] fix ssh support for third party services like gitea --- script.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/script.sh b/script.sh index 252b174..d609225 100755 --- a/script.sh +++ b/script.sh @@ -25,8 +25,10 @@ backup_path="$HOME/$backup_folder" allow_empty_commits=${allow_empty_commits:-true} git_protocol=${git_protocol:-"https"} git_host=${git_host:-"github.com"} +ssh_user=${ssh_user:-"git"} + if [[ $git_protocol == "ssh" ]]; then - full_git_url="git@"$git_host":"$github_username"/"$github_repository".git" + full_git_url=$git_protocol"://"$ssh_user"@"$git_host":"$github_username"/"$github_repository".git" else full_git_url=$git_protocol"://"$github_token"@"$git_host"/"$github_username"/"$github_repository".git" fi @@ -259,4 +261,4 @@ fi git push -u origin "$branch_name" # Remove files except .git folder after backup so that any file deletions can be logged on next backup -find "$backup_path" -maxdepth 1 -mindepth 1 ! -name '.git' ! -name 'README.md' -exec rm -rf {} \; +find "$backup_path" -maxdepth 1 -mindepth 1 ! -name '.git' ! -name 'README.md' -exec rm -rf {} \; \ No newline at end of file