From 53a04a782193c9e2f3c30b9e1f4bf2102cf29bb3 Mon Sep 17 00:00:00 2001 From: Adrian Date: Wed, 14 Aug 2024 16:06:54 +0200 Subject: [PATCH] add ssh option --- src/git_update.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/git_update.sh b/src/git_update.sh index ef92158..8dfde79 100755 --- a/src/git_update.sh +++ b/src/git_update.sh @@ -15,6 +15,7 @@ OPTIONS -H allows the $HOME directory to be used by git_update.sh. By default, git_update.sh cannot access $HOME to prevent default behavior. If you need the global .gitconfig located in your $HOME to be used, you should supply the -H option. -a specifies that the aggressive option of the git garbage collection must be used. Only advised when changes happen in many different objects. Will slow down the execution. + -o ssh options for ssh clone DESCRIPTION This script will replace the destination with the wanted commit of a git repository. The history is not preserved but tags are. Untracked files remain. The git commands have been chosen so as to minimize the memory and bandwidth usages." @@ -26,8 +27,9 @@ ref=main dst='.' use_home=false be_aggressive="false" +ssh_opts="ssh" -while getopts ":hr:d:H" option; do +while getopts ":ho:r:d:H" option; do case $option in h) # display Help Help @@ -40,6 +42,8 @@ while getopts ":hr:d:H" option; do use_home="true";; a) #use -a in git gc call be_aggressive="true";; + o) # ssh options + ssh_opts="$ssh_opts $OPTARG";; \?) # invalid option echo "Error: Invalid option here" exit;; @@ -76,6 +80,6 @@ if [ -d .git ] ; then else echo "cloning..." clone_dst='.' - git clone -b "$ref" --recurse-submodules --shallow-submodules --depth 1 "$repo" "$clone_dst" + git clone -b "$ref" --recurse-submodules --shallow-submodules --depth 1 --config core.sshCommand="$ssh_opts" "$repo" "$clone_dst" fi