Git - dev ops

Adding file to .gitignore doesn't remove it

Remember to commit everything you've changed before you do this!

git rm -rf --cached . git add . # This removes all files from the repository and adds them back (this time respecting the rules in your .gitignore).

GitHub Not Recognizing Private SSH Key

By default, GitHub only looks for keys named id_rsa and id_rsa.pub
If you want to use a custom key name, use this command to pipe in a config for your custom name

cat >> ~/.ssh/config << END
Host github.com
    IdentityFile ~/.ssh/id_rsa.github
    User git
END
        

Full reset to latest commit on branch

git fetch --all
git reset --hard origin/master
        

Git pull not pulling latest commit

git fetch origin master
git reset --hard FETCH_HEAD

will bring you to latest commit of master branch