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

前端 未结 2 1365
醉梦人生
醉梦人生 2021-01-06 18:52

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://ap         


        
相关标签:
2条回答
  • 2021-01-06 19:27

    What I would do :

     curl -u 'USER:PASWORD' https://api.github.com/user/repos -d '{"name":"REPO"}'
    

    Tested OK on my github account. That way, you will not be prompted to type your password. It that doesn't work, maybe your password is not the good one (or username).

    0 讨论(0)
  • 2021-01-06 19:48

    git@github.com:USER/REPO.git is an ssh url, not an https one.
    The "password" GitHub is asking you is because ssh doesn't find your public/private keys, and has nothing to do with your GitHub account password.

    Use:

    git remote add origin https://YourName@github.com/YourName/REPO.git
    git push -u master
    

    Then it will ask you for your http credentials.
    If you don't want to enter it for each transaction, see "Is there a way to skip password typing when using https:// github".

    0 讨论(0)
提交回复
热议问题