-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsshpass-wrapped-git.bash
More file actions
44 lines (30 loc) · 1.15 KB
/
sshpass-wrapped-git.bash
File metadata and controls
44 lines (30 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
set -e
# Arguments have not been provided
if [ -z "$@" ]; then
echo "No command provided, so will display git version";
exec git version;
# Test ssh with sshpass
elif [ $1 == "ssh" ] && [ $2 == "sshpass" ] && [ -n "$ssh_password" ]; then
#exec sshpass -p $ssh_password ssh git@github.com;
echo "sshpass test";
# Test ssh without sshpass
elif [ "$1" == "ssh" ] && [ - z "$2" ] && [ -n "$ssh_password" ]; then
#exec ssh git@github.com;
echo "ssh test";
# Switch between plain git and sshpass git based on the existence (or not) of the sshpass envionmnet variable
# Arguments are supplied and the ssh variable is set
elif [ -n "$@" ] && [ -n "$ssh_password" ]; then
# export SSHPASS=$ssh_password;
echo "Running git with sshpas... " && echo "Using parameters: " && echo "$@";
exec sshpass -p $ssh_password git "$@";
# exec -e git "$@";
# Arguments are supplied without the ssh variable being set
elif [ -n "$@" ] && [ -z "$ssh_password" ]; then
echo "Running git with sshpas... " && echo "Using parameters: " && echo "$@";
echo "Using parameters: " && echo "$@";
exec git "$@";
else
echo "Error with git-sshpass";
exit 1;
fi