Skip to content

Instantly share code, notes, and snippets.

@kirkbrady
Last active October 8, 2018 09:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kirkbrady/926ee97460eb38661e71d4103c22262e to your computer and use it in GitHub Desktop.
Save kirkbrady/926ee97460eb38661e71d4103c22262e to your computer and use it in GitHub Desktop.
git repo creation from command line

In repo dir, create a blank repo

git init

Stage existing files

git add .
git commit -m "<some message>."

Create remote repo in GitHub using REST API with MFA

curl -u "<github username>" -H "X-GitHub-OTP:<token>" https://api.github.com/user/repos -d '{"name":"<repo name>"}'

Set Git user details in repo

 git config user.name "<github username>"
 git config user.email "<github email>"

First ensure valid entries in ~/.ssh/config and valid ssh key in GitHub

git remote add origin git@github.com:<github username>/<repo name>.git
git remote set-url origin git@<ssh config host entry label>:<github username>/<repo name>.git
git push --set-upstream origin master

Test creds

ssh -T git@github.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment