New Repo Creation

Chester Wyke June 15, 2023 Updated: April 15, 2025 #git

NB: These instructions assume github with ssh key auth but any would be similar

  1. Create empty repo in cloud
  2. Create folder on local machine with same name (same name is recommended not required)
  3. Open a command prompt in the folder and initialize git
git init
  1. Create .gitignore file
touch .gitignore
  1. Add file and commit

  2. Add remote repo connection (Can be copied from github)

git remote add origin git@github.com:wykies/REPO_NAME.git
  1. (Skippable) Move to main branch (-M is a shortcut for --move --force.) This step can usually be skipped in a new repo
git branch -M main
  1. Push branch to remote and set current branch as a tracking branch (-u sets current brach to tracking)
git push -u origin main