Git and SSH
Get ready to clone, commit and push. 16 commands.
- Install Git and set your nameInstall Git and tell it who you are, so your commits are signed with your name.
- Create an SSH key and add it to GitHubSo you can push and pull from GitHub without typing a password every time.
- Install GitHub CLI and log inThe gh command for pull requests, issues and repos, signed in to your GitHub account.
- Create a branch and switch to itStart a side path for a new feature or fix, so the main version stays safe while you work.
- Fix "Permission denied (publickey)"What to check when git push or ssh to GitHub says Permission denied (publickey).
- Fix a merge conflictGit found two changes to the same lines and wants you to choose. Here's how to finish the merge.
- Fork a project and clone itMake your own copy of someone else's GitHub project and download it, ready to change.
- Merge a branch into mainBring the finished work from your branch back into the main version.
- Open a pull request from the terminalPush your branch and ask for it to be checked and merged, without leaving the terminal.
- Rebase your branch onto mainReplay your branch's work on top of the newest main, so the history reads as one straight line.
- Save your changes with a commitPick the files you changed and save them as one step in your project's history, with a short message.
- Set Git's default editorWrite commit messages in VS Code (or nano) instead of getting stuck in Vim.
- Set up a global .gitignoreStop system junk and secrets like .DS_Store and .env from ever being committed, in every repo.
- Sign your commits with your SSH keyGet the green "Verified" badge on GitHub, using the SSH key you already have.
- Stop Git asking for your passwordSave your GitHub login for HTTPS remotes, so push and pull stop prompting every time.
- Use two GitHub accounts on one machineKeep a work and a personal GitHub account side by side, each with its own SSH key.