简体   繁体   中英

github permission denied to push to my own repo

Recently I created an empty repos on github and cloned it to my laptop. I wrote some stuff and wanted to push it to the github repos, so I committed locally then entered

git push origin master

That produced an error message:

Fatal: HttpRequestException encountered. An error occurred while sending the request. Username for ' https://github.com ': xxxxx Password for ' https://xxxxx@github.com ': remote: Permission to xxxxx/yyyyy.git denied to xxxxx. fatal: unable to access ' https://github.com/xxxxx/yyyyy.git/ ': The requested URL returned error: 403

Where "xxxxx" is my username on github and yyyyy is my project (still empty!)

So, what am I missing? What do I need to do to push to my own repos on github?

If you're using 2-factor authentication, you need to set up a personal access token to use instead of your password when pushing over HTTPS. In your account settings, go to Developer settingsPersonal access tokens and generate a token with repo access, then use that instead of your password.

Alternatively, you can set up an SSH key and push over SSH, which I find more convenient.

Last time I tried this, the popup gui prompted me for the code sent to my phone. That solves the problem for now.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM