How to push repo from git

Hi,

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

1 vote
Accepted answer

Suresh,

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

ssh -Tv git@bitbucket.org

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
Host bitbucket.org
 IdentityFile ~/.ssh/my_key_rsa

  • You've updated the remote to point to Bitbucket
git remote add bitbucket git@bitbucket.org:{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 git@bitbucket.org:{username}/{repo slug}.git

Thanks...

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

I tried with git remote add bitbucket.org/{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 Sign up to answer
Community showcase
Published Nov 06, 2018 in Bitbucket

Upgrade Best Practices

Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...

191 views 3 6
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