Adventures with git & github
A few tricks and useful work methods with git and github.
Because good git habits are kind of essential.
setup your git and github with an ssh key.
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
is my ssh agent running?
echo $SSH_AGENT_PID
ps -p $SSH_AGENT_PID
ssh-add ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub
part 2 : add ssh key to github
Some useful git commands.
git remote rm origingit branch
git branch -a
git branch -r
git remote add origin git@github.com:<username>/blah.git
check .gitignore exists
there are multiple .gitignore templates. worth understanding the basics to avoid adding large zip files or even larger directories of unzipped files to your git repo.
I’ve added this list of file extensions to minimise potential to add data files to my git repo.
Good practice is to have data files stored outside the git repo directories.
*.zip*.tar*.gzip*.jpg*.tar.gz*.tar.Z*.tgz*.pdf*.bmp*.tiff*.jpeg*.png
quick git commands to commit your local changes.
do one of the many git tutorials if not already familiar.
git add .
git commit -m '<some message>'
git push
— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
Non essential notes below.
first time using git from a new server will see the message below.
worth checking since the default values may not be correct.
git config --global --edit
enter values to match your github account.
https://github.com/settings/profile
git commit --amend --reset-author