Notes 🗒️
This markdown is a personal reminder to help me remember how to correctly setup my git repositories using command line and SSH connection/signing. This is not a full step by step guide designed for everyone, as it assumes you have already generated and added your SSH key to your GitHub account. I will keep this guide up to date.
First setup
- Setup username
git config --global user.name "User"
- Setup email
git config --global user.email "me@example.com"
- Setup default editor
git config --global core.editor nvim
- Configure default branch name to be 'main' instead of 'master'
git config --global init.defaultBranch main
- Configure Git to use SSH to sign commits and tags
git config --global gpg.format ssh
- Set up the SSH key you would like to use
git config --global user.signingkey /PATH/TO/.SSH/KEY.PUB
- Configure commit signature
git config --global commit.gpgsign true
Initializing repo 🚀
- Open git bash and locate your project directory
cd PATH/TO/YOUR/PROJECT
- Init your git project
git init
- Add your .gitignore template to your project, you can find good ones here
- Check the status with
git status
- Add all untracked files
git add ./
ORgit add *
- Initial commit
git commit -a -m "Initial commit"
Setting up remote 🌍
- Create a new empty repo on GitHub.com
- DO NOT add a licence, or readme or whatever, we will do it afterwards, no need to create merge conflicts now.
- Set up remote
git remote add origin ssh://git@ssh.github.com/USERNAME/PROJECT_NAME.git
git branch -M main
git push -u origin main
- You can now check if your commit was verified correctly on GitHub!
[!IMPORTANT] You encountered an error? Go check out GitHub Troubleshooting SSH guide
[!INFO] To make sure everything gets pushed to your remote:
git push -u origin --all
git push -u origin --tags
Adding README and licence files
Licence 📜
README 📑
- Read https://www.makeareadme.com
- Create your readme easily on https://readme.so/editor
- Import it to your project, then commit & push
I am not a readme expert.
Other files 📝
- A changelog is a great way to track updates of various releases https://keepachangelog.com
- CONTRIBUTING.md is essential for open-source projects, see GitHub docs
- You can also add :
Useful links 🔗
[!TIP] You can check whether your SSH GitHub connexion works using
ssh -T git@github.com
. It should greet you withHi USERNAME! You've successfully authenticated, but GitHub does not provide shell access.