Skip to content

Instantly share code, notes, and snippets.

@alexpchin
Last active December 21, 2024 15:27
Show Gist options
  • Save alexpchin/dc91e723d4db5018fef8 to your computer and use it in GitHub Desktop.
Save alexpchin/dc91e723d4db5018fef8 to your computer and use it in GitHub Desktop.
Create a new repository on the command line

Setting up a new Git Repo

##Create a new repository on the command line

touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin git@github.com:alexpchin/<reponame>.git
git push -u origin master

##Push an existing repository from the command line

git remote add origin git@github.com:alexpchin/<reponame>.git
git push -u origin master
@jamiecropley
Copy link

You don't even need to login / authorise every single time, just set up SSH key on computer, then do gh repo create nameofrepo then go to the url it generates and it automatically tells you all the command lines to do, but as you mentioned git add . is the only thing to change really.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment