简体   繁体   中英

Cannot post projects in github

Earlier I used to use bitbucket.org. But it was not working for me as I could not push my Django projects. Whenever I gave the command:

git push -u origin master   

git@bitbucket.org: Permission denied (publickey).
fatal: Could not read from remote repository.

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

Could not understand where I had gone wrong.
Created the repo perfectly with the command:

git remote add origin https://sandywandy@bitbucket.org/sandywandy/blog-app.git

Nothing worked. Posted queries here. None could help me. Now I have shifted to github.com. The same problem is still chasing me. And surprisingly now the error comes still with bitbucket when I am using the commands of GitHub.
If anyone has any solution please help.

Since you are pushing with HTTPS, check if you have a git credential helper which could have cached the wrong password for your private repo:

git config credential.helper

You might have to delete your cached credentials (as shown here on Windows , or here for MacOS )

Note: git remote add simply declare the repo URL in your local repo.
It does not "create" the remote repo.

Check the output of git remote -v: if it is an ssh URL (like git@bitbucket.org:... ), change it to an https one:

git remote set-url origin https://sandywandy@bitbucket.org/sandywandy/blog-app.git

In your case:

git remote set-url origin https://sandywandy@bitbucket.org/sandywandy/blog-app.git
git push -u origin master

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