0

Goal: When I do git push -u origin master I want my local PC to push to GitHub instead of BitBucket.

Background: I had BitBucket setup in my Mac as default website to push code to. But I decided to switched to GitHub for a new project. Here is my cmds and error I got:

Commands:

cd proj1
git init
echo "# tmp" >> README.md
git add README.md
git commit -m "first commit"
git remote add origin git@github.com:myusername/proj1.git
git push -u origin master

Error:

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

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

Thanks in advance for your help.

LED Fantom
  • 1,229
  • 1
  • 12
  • 32
  • See here: https://gist.github.com/mandiwise/5954bbb2e95c011885ff – NewEyes Mar 28 '19 at 14:47
  • Possible duplicate of [pull/push from multiple remote locations](https://stackoverflow.com/questions/849308/pull-push-from-multiple-remote-locations) – phd Mar 28 '19 at 15:33
  • https://stackoverflow.com/search?q=%5Bgit%5D+push+two+remotes – phd Mar 28 '19 at 15:33
  • https://stackoverflow.com/search?q=%5Bgit%5D+push+multiple+remotes – phd Mar 28 '19 at 15:34
  • The previous comments don't answer my question, so I clarified my question. – LED Fantom Mar 29 '19 at 14:48
  • Possible duplicate of [GitHub Error Message - Permission denied (publickey)](https://stackoverflow.com/questions/12940626/github-error-message-permission-denied-publickey) – Nils Werner Mar 29 '19 at 16:43

1 Answers1

0

If this project previously been connected to BitBucket, you may need to edit your existing git file to make sure you are pointing to GitHub instead of BitBucket. If that is not the case, make sure you have set up your credentials to show you have permission to access the account/repo on GitHub. Here is a link with info on how to do that. Check out the git config commands. https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration