Last active
July 10, 2022 20:07
-
-
Save 0187773933/4466ddf106207bc11b55617a507cac38 to your computer and use it in GitHub Desktop.
Git Push Update
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function is_int() { return $(test "$@" -eq "$@" > /dev/null 2>&1); } | |
sudo pkill -9 ssh-agent | |
eval `ssh-agent -s` | |
ssh-add -D | |
ssh-add -k /home/morphs/.ssh/github-ssh-private-key | |
ssh -vT [email protected] | |
git init | |
git remote remove origin | |
git config --global --unset user.name | |
git config --global --unset user.email | |
git config user.name "github-username" | |
git config user.email "[email protected]" | |
LastCommit=$(git log -1 --pretty="%B" | xargs) | |
# https://stackoverflow.com/a/3626205 | |
if $(is_int "${LastCommit}"); | |
then | |
NextCommitNumber=$((LastCommit+1)) | |
else | |
echo "Not an integer Resetting" | |
NextCommitNumber=1 | |
fi | |
git add . | |
git commit -m "$NextCommitNumber" | |
git remote add origin [email protected]:github-username/repository-name.git | |
git push origin master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment