Skip to content

Instantly share code, notes, and snippets.

@becomesaflame
Last active February 15, 2022 14:11
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 becomesaflame/d10b2e534d34b8ee1581fb72198aa990 to your computer and use it in GitHub Desktop.
Save becomesaflame/d10b2e534d34b8ee1581fb72198aa990 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Update local repos from github and then push local changes
# Uses ssh-agent so password only needs to be entered once,
# instead of once per repo
# Start ssh-agent
SSHAGENT=`which ssh-agent`
if [ -z "$SSH_AUTH_SOCK" -a -x "$SSHAGENT" ]; then
echo "Starting ssh-agent"
eval `ssh-agent -s`
ssh-add ~/.ssh/id_rsa
trap "kill $SSH_AGENT_PID" EXIT
fi
# go up a level to git directory
cd ..
# Temporarily switch to use GitHub certs
git config --global http.sslbackend schannel
# dotfiles
echo "Updating dotfiles"
cd dotfiles
git pull
git push
git push clueserver
cd ..
# git_usage
echo "Updating git_usage"
cd git_usage
git fetch github
git merge github/master
git push github master
cd ..
# tldr
echo "Updating tldr"
cd tldr
git pull
cd ..
# vim quick ref
echo "Updating vim quick ref"
cd vim_quick_ref
git pull
git push
cd ..
# bash notes
echo "Updating bash notes"
cd bash_notes
git pull
git push
cd ..
# Anki Conversion
echo "Updating Anki Conversion"
cd anki-conversion
git pull
git push
cd ..
# Knots Anki
echo "Updating Knots Anki"
cd knots_anki
git pull
git push
cd ..
# Update git gist
echo "Updating git update gist"
cd gist_update_github
git pull
git push
cd ..
# Update DSP notebook
echo "Updating DSP notebook"
cd dsp_notes
git pull
git push
cd ..
# # hex_structure_calc
# echo "Updating hex_structure_calc"
# cd hex_structure_calc
# git pull
# git push
# cd ..
# Switch back to use GitHub Enterprise certs
git config --global http.sslbackend openssl
# Exit ssh-agent
if [${SSH_AGENT_PID:+1} == 1 ]; then
ssh-add -D
ssh-agent -k > /dev/null 2>&1
unset SSH_AGENT_PID
unset SSH_AUTH_SOCK
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment