Skip to content

Instantly share code, notes, and snippets.

@mdashti
Last active September 22, 2022 22:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mdashti/2007c6663d055792e509 to your computer and use it in GitHub Desktop.
Save mdashti/2007c6663d055792e509 to your computer and use it in GitHub Desktop.
Bash script for git pull using username and password
#!/bin/bash
path="/var/www/sites/htdocs/wp-content/themes/vip/";
git_path="https://username:password@mdashti.com/DBToaster/";
git_array=( plugins pmc-variety pmc-plugins );
git_path_array=("${git_array[@]}")
git_path_array[0]=wordpress-vip-plugins;
#git_path_array[1]=pmc-variety-interim;
total=${#git_array[*]}
for (( i=0; i<=$(( $total -1 )); i++ ))
do
echo "\n$path${git_array[$i]}\n";
cd $path${git_array[$i]};
echo $git_path${git_path_array[$i]}".git";
git pull $git_path${git_path_array[$i]}".git";
done
echo -e '\n Complete';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment