How to push repo from git


I'm having github files and i have remote for that. Now i want to use bitbucket. So for that i have added new ssh key. Now my problem is, i'm trying to push the files form local disk to bitbucket.

Its Showing error like " Permission denied (publickey). Fatal: could not read remote repo. Please make sure you have the correct access rights and repo exists. "

Please help me...

1 answer

1 accepted


You can test immediately if your key is loaded properly by doing the following:

ssh -Tv

If this fails, then you'll need to double check your settings as noted in our documentation:

  • Add the key in Bitbucket
  • Add the key in your ~/.ssh/config file like
 IdentityFile ~/.ssh/my_key_rsa

  • You've updated the remote to point to Bitbucket
git remote add bitbucket{username}/{repo name}.git

Finally, if this still isn't working for you. Check out our troubleshooting guide.

Thanks Marcus...

I tried to clone my repo...It works fine. I have push the file using git push <URL> command. I cannt use repo reference name. Why?

You need to update your remotes.

git remote -v
git remote rm origin
git remote add origin{username}/{repo slug}.git


I did git remote add https://{username}{username}/{repo slug}.git.

I tried with git remote add{username}/{repo slug}.git and it returns error like Permission denied (publickey), Could not read from remote repo.

I left off the 'origin' specification in my example. Try that again.

Suggest an answer

Log in or Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

643 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot