Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Can't read from remote repository

UnitFactory January 14, 2023

Hello,

i create a new repository inside bitbucket. I run this commands, like the commands bitbucket shows on the repository page, copy and paste:

git remote add origin git@bitbucket.org:...
git push -u origin master

But by the push command i got the error:
The requested repository either does not exist or you do not have access. If you believe this repository exists and you have access, make sure you're authenticated.

This is what i checked:
- I renew my ssh key in bitbucket
- git remote -v show the correct url to the repository
- ssh -Tv git@bitbucket.org works fine, because i got the message "authenticated via ssh key. You can use git to connect to Bitbucket. Shell access is disabled"

What can be wrong?

Cheers
Ralf

1 answer

1 vote
Syahrul
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 16, 2023

Hey Ralf,

G'day.

I'd say use the following verbose command with the git push options parameter, as it'll give you more information on why the push failed:

GIT_TRACE_PACKET=1 GIT_TRACE=1 GIT_SSH_COMMAND="ssh -vvv" git push -u origin master

Look at what SSH config git uses and what keys are being offered to push. There's usually an issue where git uses a different ssh config that redirects to another ssh key which causes the issue.

Cheers,
Syahrul

 

UnitFactory January 17, 2023

Hi Syahrul,

this is the result from your command:

redacted

As far as I can see, the id file is correct. The only error is, that the remote repository cant be read

Cheers
Ralf

Syahrul
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 17, 2023

Hey Ralf,

I remove the log due to privacy concerns.

From the log, I noticed it uses a different SSH key to authenticate from the default

/Users/<name>/.ssh/config location, so I wonder which key you used on your account.

If it's the default id_rsa, then can I suggest you manually add the following in the 

/Users/<name>/.ssh/config to explicitly ask SSH to use the default key only:
  1. Run the following command, replacing the {ssh-key-name} with the name of the private key:

    ssh-add ~/{ssh-key-name}
  2. To ensure the correct SSH key is used when connecting to Bitbucket, update or create your SSH configuration file (~/.ssh/config) with the following settings:

    Host bitbucket.org
     AddKeysToAgent yes 
    IdentityFile /Users/<name>/.ssh/{ssh-key-name}

    Where {ssh-key-name} is the location of the private key file once it has been added to the ssh-agent.

Let me know how it goes.

Cheers,
Syahrul

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events