How to quickly set up your new Github project

If you want to set up your new pet or study project from scratch in 2025, you might want to use https://github.com for version control and Docker for running a dev environment to get a smooth and quick start. Let’s start with a git repository. Here is a step by step instruction.

  1. Go get a gihub.com account
  2. Start a new repository there. Let’s assume you called it api
  3. Providing you have git installed already on your computer and having some folder structure and code for your project you first run git init in the root folder of your project.
  4. You can add files to stage by git add . , commit them with git commit -m "description" however your repository will stay local yet.
  5. We need to set up an ssh access to your repository. Let’s create an ssh key first: ssh-keygen -t ed25519 -C "mail@gmail.com" then pick any name for the key. There will be two: a private one and a public one (with the extension .pub). By default the keys will be stored in the subfolder .ssh of your home folder. Let’s assume you named your key my_key
  6. Copy the contents of the newly added pub key to the clipboard. On MacOS you can do it with pbcopy < ~/.ssh/my_key.pub
  7. Go to the settings of your ssh access on github repository settings page and copy paste the pub key there.
  8. Add the newly added key to your system ssh-add -K ~/.ssh/my_key
  9. Find and edit your ssh config, usually it’s located in ~/.ssh/config
  10. Add your new key there:
Host github.GITHUB_REPOSITORY_NAME
  HostName github.com
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/my_key

11. Done with ssh, let’s set up the repository itself. Let’s assume your main branch is called main rather than master (considered more politically correct now). Add origin git remote add origin git@github.GITHUB_REPOSITORY_NAME:GITHUB_REPOSITORY_USERNAME/api.git here api.git is the name of your git repository

12. Set URL: git remote set-url origin git@github.GITHUB_REPOSITORY_NAME:GITHUB_REPOSITORY_USERNAME/api.git Pay attention to GITHUB_REPOSITORY_NAME – this is important to set it up if you want to work with more than one Git repositories on the same computer, and you want them to use separate keys to access each of them.

13. Check your links to the remote repository: git remote -v

14. Try to push your code to this remote repository: git push -u origin main

Enjoy your work!

Leave a Comment

Your email address will not be published. Required fields are marked *