0

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.

phd
  • 82,685
  • 13
  • 120
  • 165
Sandip Nath
  • 622
  • 2
  • 8
  • 18

1 Answers1

1

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
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • @SandipNath Can you try in your Git repo folder: `git remote set-url origin https://sandywandy@bitbucket.org/sandywandy/blog-app.git`, then `git push -u origin master` – VonC Sep 30 '18 at 15:32
  • Oh wonderful!!! Many many thanks VonC. It now works as it should. You are really a master VonC. – Sandip Nath Oct 01 '18 at 15:11