Instantly share code, notes, and snippets.

Embed
What would you like to do?
Initializing GitHub repository

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 https://github.com/seankross/womp.git
git push -u origin master

Push an existing repository from the command line

git remote add origin https://github.com/seankross/womp.git
git push -u origin master
@NedyUdombat

This comment has been minimized.

Copy link

NedyUdombat commented Jan 3, 2018

This did not work, any idea why?

@xairam

This comment has been minimized.

Copy link

xairam commented Feb 4, 2018

remote: Repository not found.
fatal: repository 'https://github.com/xairam/repemo.git/' not found
Seems like you need to create a repo 1st on github and than ppush it.

@BarbzYHOOL

This comment has been minimized.

Copy link

BarbzYHOOL commented Mar 5, 2018

The remote used is a SSH one and not HTTPS, can change it easily though. If using SSH, it requires SSH keys (and it won't ask for password, so that's useful)

curl -u 'USER' https://api.github.com/user/repos -d '{"name":"REPONAME"}'
git remote add origin git@github.com:USER/REPONAME.git
git push origin master

@InTEGr8or

This comment has been minimized.

Copy link

InTEGr8or commented Apr 25, 2018

Please make sure you have the correct access rights
and the repository exists.

I don't think this creates the remote repository on the server. It just creates a remote pointer in the local git repo.

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