You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Basically this script would run in your root folder of your repositories which contains all your repositories and do a git pull on all of them.
For better functioning, use SSH when cloning your repositories. So you don't need to enter a password at the time of git pull.
Step By Step:
1. Creating the file:
nano git-pull-all-repos.sh
2. Adding permissions to the file:
sudo chmod 777 git-pull-all-repos.sh
3. Now let's copy the script below and put it inside the git-pull-all-repos.sh file we created in the previous step:
#!/bin/bash# Getting absolute path to file
SCRIPT=$(readlink -f "$0")# Getting only the absolute path (without the file name in the path)
SCRIPTPATH=$(dirname "$SCRIPT")# Showing the path where it contains the repositoriesecho"PATH: $SCRIPTPATH"# Looping over the command "ls -d */". It will return a list of directories.forOUTPUTin$(ls -d */)doecho"--------------------------"echo"REPOSITORY: $OUTPUT"cd$SCRIPTPATH/$OUTPUT
git pull
cd ..
done