I have an individual bitbucket account and am a member of a team on bitbucket.
Recently I created a new bitbucket repository on my individual account and pushed code from a local repository into it. I then transfered that repository from my individual account to my team account, and I accepted the transfer on behalf of my team.
After making some changes on my local code base i tried to push those changes to origin with a git push and received the following error message:
nw-client (master)]$ git push fatal: https://[myname]@bitbucket.org/[myname]/nw-html-client.git/info/refs?service=git-receive-pack not found: did you run git update-server-info on the server?
I realized at that point that I needed to update my origin's URL, so I typed the following git command into the terminal:
git remote set-url origin firstname.lastname@example.org:[myteamname]/nw-html-client.git
[nw-client (master)]$ git ls-remote Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
My git.config file looks like this:
[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true ignorecase = true precomposeunicode = false [remote "origin"] url = git@bitbucket.[myteamname]/nw-html-client.git fetch = +refs/heads/*:refs/remotes/origin/* [branch "master"] remote = origin merge = refs/heads/master
What am I doing wrong? Any help would be greatly appreciated!
Thank you for your question.
It seems you had your repository under the HTTPS protocol and once you set the URL origin your repository became to connect under the SSH protocol. Would be possible to generate a key-pair, add the public key to your Bitbucket repository and the private key to your ssh and give it a try, please.
I had the same issue and followed your suggestion. Looks like the initial issue was solved but now I'm not able to perform a push of my commit due to this error:
repository access denied. access via a deployment key is read-only.
fatal: Could not read from remote repository.
for some reason I don't get the Read, Read/Write options shown on step 5 in the document you shared.
Under myrepository/settings/access keys looks like I'm given only the option to add read-only keys:
I am the owner/admin of the repository I'm trying to commit to.
How can I enable the Read/Write option?
The screenshot you have provided suggests your repository is on Bitbucket Cloud (https://bitbucket.org).
The documentation mentioned (SSH access keys for system use) relates to Bitbucket Server instead.
Perhaps, go to your user account in Bitbucket Cloud and add SSH key from there instead (Cog icon >> Bitbucket settings >> Security >> SSH keys)
Rafael, I followed your instructions but can't really say conclusively if it worked: when I tried to run the push command I got an error about the URL not found. I changed the type of repository from SSH to HTTPS in Sourcetree, which changed the URL. When I attempted the push again I was prompted with a window to enter the bitbucket credentials (due to the HTTPS method) and I was finally able to make the commit but I can't say if the the SSH keys configured in the server side had anything to do - probably not.
In any case the Add SSH keys window was also without Read/Write option.
Quick question: the SSH key set in the server section would be global for anything on the bitbucket account (as opposed to specific to the repository)?
thanks again for the help
These answers pointed me in the right direction. I had a similar issue pushing after I cloned from my bb repo to a rasp pi and couldn't the push changes to origin master. I had already added my linux pi's ssh public key to the bb keys but still got fatal error. I changed git config to use https by using
git remote set-url origin https://email@example.com/.../somerepo.git
and then could push as expected.
In my case, the build machine had been misconfigured - the id_rsa and id_rsa.pub files were owned by root, so the local jenkins account could not read from the private key to authenticate!
The solution was to change ownership of these files to the local jenkins user:
$ sudo chown jenkins ~jenkins/.ssh/id_rsa ~jenkins/.ssh/id_rsa.pub
where "jenkins" is the name of the account our jenkins build manager uses to login and conduct a build.
I also encountered a similar problem recently, I could load my remote repositories but not clone/pull/push etc. As has happened before this had to do with locally adding the ssh key to my ssh-agent. This is a problem I've run into more often on mac. I found this article very useful:
The problem is that sourcetree is loading url of remote when you add it by that button with link firstname.lastname@example.org:rene-dohan/ but then it is failing with that git error
and you have to change it manually to https://email@example.com/rene-dohan/ , its clear bug on side of sourcetree but I think they just didn't get it yet...
1 - sure you have to modify links I posted to yours ;) haha
2- Anyway nice program for the price :)
Also remember to check if you have double SSH keys loaded in your agent. I had 2 valid SSH keys for bitbucket.org, but the another one was for completely different Bitbucket account.
I have MacOS and I use ~/.ssh/config file. Also debugging with "git -Tv -i path_to_my_key_file firstname.lastname@example.org" seemed to work fine, it even said it loaded the right key file succesfully. Only difference was the username.
ssh-add -D # Use this to remove all keys from agent
ssh-add ~/.ssh/my_specific_id_rsa # Only load the one you need
I have used to normally type in just:
ssh-add # WITHOUT specifying a key, it loaded the default "id_rsa" key and I then had 2 bitbucket keys loaded into agent
So heads up for everyone with multiple Bitbucket accounts.
I am also unable to manage a remote repository.
The errors are:
fatal: protocol 'git clone https' is not supported
git -c filter.lfs.smudge= -c filter.lfs.required=false --no-optional-locks -c color.branch=false -c color.diff=false -c color.status=false -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree clone email@example.com:LannaVrevskya/remotesourcetree.git /Users/lannavrevskya/remotesourcetree
Please make sure you have the correct access rights
and the repository exists.
Cloning into '/Users/lannavrevskya/remotesourcetree'...
firstname.lastname@example.org: Permission denied (publickey).
fatal: Could not read from remote repository.
Will be glad to get a solution.
I followed the bit about
git push -u origin --all
and noticed that -- even though it didn't work -- I was able to get a little bit more information about the problem. I pared down the possible causes until I knew that it had something to do with my feature branch's dependence on another branch. I was able to solve the problem with these two commands
git push -u origin independent_branch
git push -u origin dependent_branch
I hope that helps someone else.
Nice! It works.
First I checked If I have existing SSH key from GIt Bash
I saw I have generated it already unconsciously :) as I am a newbie.
Then I run the SSH file in the background
After that, I have copied the code and added to my git account from settings
Now I can push my files remotely
Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster ! While we’re all excited about the new improvements to Bitbucket ...
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