"Bad Credentials" when attempting to create a GitHub repo through the CLI using curl

Viewed 4351

I'm trying to create a GitHub repo using the command line.

It was suggested here that you can use the following command:

curl -u 'USER' https://api.github.com/user/repos -d '{"name":"REPO"}'
# Remember replace USER with your username and REPO with your repository/application name!
git remote add origin git@github.com:USER/REPO.git
git push origin master

When I use it, I'm prompted to enter my password (which I am positive is correct as I can log in successfully on the GitHub.com). I then receive this error:

c:\Development\Projects\MovieStar>curl -u 'jonnymaceachern' https://api.github.com/user/repos -d '{"name":"MovieStar"}'
Enter host password for user ''jonnymaceachern'':
{
  "message": "Bad credentials",
  "documentation_url": "http://developer.github.com/v3"
}

I've tried with no quotes around my username and it just gives me a "Problems parsing JSON" error.

2 Answers
Related