Skip to content

Commit

Permalink
fix ssh support for third party services
Browse files Browse the repository at this point in the history
like gitea
  • Loading branch information
Staubgeborener committed Nov 20, 2024
1 parent 95fb874 commit 969808a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {} \;

0 comments on commit 969808a

Please sign in to comment.