Skip to content

Git Existing Code → New Remote Repo

  • Local folder name = repo name
  • Know:
    • default branch (usually main)
    • remote URL

Terminal window
git init
git add .
git commit -m "initial commit"
git branch -M main
git remote add origin [GIT URL]
git push -u origin main
Terminal window
git remote add origin [GIT URL]
git branch -M main
git push -u origin main

Avoid committing:

  • build folders
  • system files
  • generated files
  • IDE settings

Use: https://github.com/github/gitignore

  • Required for adoption
  • Many companies only allow specific licenses

Basics to check:

  • permissive vs copyleft
  • compatibility
  • permissions

Use: https://opensource.org/licenses

  • Short project description is enough to start
  • Improve over time
  • Create an empty remote repository
  • Match local folder name with repo
  • Add .gitignore
  • Choose a license (if OSS)
  • Create a README
  • Push the initial commit