##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
since August 2021, using bare HTTPS with a username/password no longer works to create a repo on git. Instead, use a PAT (Personal Access token) created in the web API.
The samples above return:
{ "message": "Requires authentication", "documentation_url": "https://docs.github.com/rest/reference/repos#create-a-repository-for-the-authenticated-user" }
Here's the way that will create a repository using cmdline:
curl -H "Authorization: token {your_personal_access_token}" https://api.github.com/user/repos -d '{"name":"{new_repo_name}"}'