Skip to content

Instantly share code, notes, and snippets.

@pwndev
Last active December 8, 2021 08:40
Show Gist options
  • Save pwndev/71ecbe221c9390b38e34571d59623a55 to your computer and use it in GitHub Desktop.
Save pwndev/71ecbe221c9390b38e34571d59623a55 to your computer and use it in GitHub Desktop.
Cheatsheet to create or import existing repositories

Create new local repository and push to origin

echo "# Title" >> README.md
git init
git add README.md
git commit -m "Initial commit"
git branch -M main
git remote add origin git@github.com:<user/orga>/<repo>.git
git push -u origin main

Push an existing repository from the command line

git remote add origin git@github.com:<user/orga>/<repo>.git
git branch -M main
git push -u origin main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment