It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

I am logged in but bitbucket throws an error when I try to push

dfiler:~/workspace/sample_app (master) $ git push -u origin --all
ssh: Could not resolve hostname gitbitbucket.org: Name or service not known
fatal: Could not read from remote repository.

I get the above error message. What am I doing wrong?

 

Don filer

2 answers

1 accepted

0 votes
Answer accepted

Thanks, Brian,

     I deleted the repository that was not taking my changes. I resubmitted my SSH Key and I initialized the repository again. When I pushed the project up it  indeed was missing the @ sign in the address but I included it in the git remote add origin command and it responded that it was there. I might be doing something wrong, but I can't determine what it is from my end.
Bryan Turner Atlassian Team Jun 16, 2016

When you say "it responded that it was there", I think that's an error saying there's already an "origin" remote, not that the @ sign was already present. If the remote exists, you either need to git remote rm origin to remove it, or you need to use git remote set-url origin ... to change it.

I tried changing the remote address, adding the @ sign but when I tried to push this is what I got.

dfiler:~/workspace/sample_app (master) $ git remote set-url origin git@bitbucket.org:donfiler/sample_app.git
dfiler:~/workspace/sample_app (master) $ git push -u origin --all
Warning: Permanently added 'bitbucket.org,104.192.143.1' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Bryan Turner Atlassian Team Jun 16, 2016

"Permission denied (publickey)" indicates you have not setup your SSH key correctly at bitbucket.org. Since your public key isn't setup, Bitbucket rejects your SSH request.

3 votes
Bryan Turner Atlassian Team Jun 16, 2016

Don,

I think you've got a bad remote URL in your repository. It looks like you've got "gitbitbucket.org", but what it should be is "git@bitbucket.org", where "git" is the username and the host address is "bitbucket.org". Note that "git" will always be the username, not your username. Even though you push with the "git" username, your username will be associated with the push because the SSH key used to authenticate with the server is associated with your account.

You can confirm your URL by running git remote -v to see what it is. If it's not correct, you can use something like git remote set-url origin git@bitbucket.org:<user>/<repo>.git, where you'll need to substitute in the <user> and <repo> you're trying to push to. Unfortunately I can't glean that from the error snippet posted. You can get the exact URL you should use from the Bitbucket UI; it will be called the "Clone URL". It's shown in the upper-right corner on the overview, or by clicking the "Clone" action in the sidebar.

If you haven't associated an SSH public key with your Bitbucket account, you'll be unable to push over SSH even using the correct URL. This tutorial can help you set up your SSH key if you haven't already.

Best regards,
Bryan Turner
Atlassian Bitbucket 

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

Atlassian supported Jenkins integration for Bitbucket Server

We’ve been building a plugin to integrate Bitbucket Server and Jenkins CI, and I’m excited to announce that our alpha is ready to download and install. It lets you seamlessly configure a Jenkins job ...

1,084 views 3 17
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you