GitHub Cheat Sheet
Server Edition — SSH only
Logging in with GitHub CLI (headless servers)
gh auth login -h github.com
Choose:
GitHub.com
SSH
Skip
Login with a web browser
Enter the code
Press Enter in the terminal
Check status:
gh auth status
Converting a remote to SSH
git remote add origin git@github.com:theo-langstraat/{repository}.git
git remote set-url origin git@github.com:theo-langstraat/{repository}.git
Verify:
git remote -v
Pushing to GitHub
git add .
git commit -m "type: subject"
git push
If pushing fails because histories differ:
git push --force origin main
Commitlint follows the Conventional Commits specification. A commit message must contain at least:
type — category of the change (lowercase)
subject — short description (lowercase)
Valid types include:
feat — new functionality
fix — bug fix
docs — documentation
chore — maintenance
refactor — code restructuring
test — test files
build — build system
ci — CI configuration
Creating a release with GitHub CLI
gh release create 1.0.0 build/dailyverses-1.0.0.zip --notes "Initial release"
Upload release assets:
gh release upload 1.0.0 build/dailyverses-1.0.0.zip
Fixing gh-auth issues
Reset configuration
rm -rf ~/.config/gh
mkdir ~/.config/gh
chmod 700 ~/.config/gh
Remove text browsers (prevents login crashes)
sudo apt remove w3m lynx links elinks links2
Debugging
GITHUB_DEBUG=1 gh auth login -h github.com
Checking Git
View remotes
git remote -v
Push branch
git push -u origin main
Test SSH
ssh -T git@github.com
Useful Git commands
New branch
git checkout -b feature/name
Delete branch
git branch -d feature/name
Amend last commit
git commit --amend
Using stash
git stash
git stash pop
Server tips
Always run
gh auth loginfrom your home directoryAlways use SSH for Git
Never copy GitHub instructions that use
https://Remove text browsers on headless servers
gh auth statusis your best friend
Diversen
gh auth login
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
git init
gh repo create calimporter --public --source=. --push
git add .
git commit -m "Dynamic flexfroms moved outside extension to var/"
git branch -M main
git remote add origin https://github.com/theo-langstraat/dailyverses.git
git push -u origin main
^` or create a new repository on the command line
echo "# test" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/theo-langstraat/test.git
git push -u origin main
^` or push an existing repository from the command line
git remote add origin https://github.com/theo-langstraat/test.git
git branch -M main
git push -u origin main