Repository access denied. access via a deployment key is read-only

前端 未结 18 2018
孤城傲影
孤城傲影 2020-11-29 15:49

After successfully cloning my repo from heroku and added another remote

1/ git clone git@heroku.com:[APP].git
2/ git remote add bitbucket ssh://git@bitbucket         


        
相关标签:
18条回答
  • 2020-11-29 16:08

    I would like to re-emphasize the following:

    • You might have added the SSH key to your repository (e.g. ExampleRepo), but this is NOT where the SSH key goes.
    • It is meant to go into YOUR PROFILE. This is the small avatar on the bottom left corner of the screen. Here, you'll find a different place to put your SSH Keys (under Security) > then you add the key here instead.
    • If you accidentally put your SSH key into the repository (as opposed to your account), then delete the one in the repository.

    Took me ages to realise, somehow even after reading the answers here it didn't click.

    0 讨论(0)
  • 2020-11-29 16:09

    First confusion on my side was about where exactly to set SSH Keys in BitBucket.

    I am new to BitBucket and I was setting a Deployment Key which gives read-access only.

    So make sure you are setting your rsa pub key in your BitBucket Account Settings.

    Click your BitBucket avatar and select Bitbucket Settings(Manage account). There you'll be able to set SSH Keys.

    I simply deleted the Deployment Key, I don't need any for now. And it worked

    0 讨论(0)
  • 2020-11-29 16:10

    Deployment keys are read only. To enable write access you need to:

    • Remove this deployment key from your repository settings. You won't be able to write to this repo with this key anyway.

    • Go to "Avatar -> Settings -> SSH Keys" and add the same key

    • Now try to push to remove branch

    You were able to write to repositories before but this is a change in BitBucket where you're no longer able to write with deploy key.

    0 讨论(0)
  • 2020-11-29 16:10

    Steps:

    1. Create ssh keys on source server

      ssh-keygen

    2. Cat and copy id_rsa.pub located under ~./ssh directory

    3. Go to Bitbucket, if you have already set the access keys for repository(s) then delete existing public key(s)
    4. Go to Bitbucket avatar> Bitbucket settings> SSH Keys (under Security, left pane)> Click on 'Add Keys'> paste the public key.
    5. Check if it works by running below command on the source server

      git remote show origin

    6. For fetch and push from the source server, if the protocol is 'https' then you have to change it to 'git+ssh' by running below command

      git remote set-url origin git+ssh://<bitbucketaccount>@bitbucket.org/<accountname>/repo.git

    7. Check if you can do push to the repo.

    Done!

    0 讨论(0)
  • 2020-11-29 16:14

    I had the same issue Kabir Sarin had. The solution was to clone the repo via SSH, instead of using the https URL. so this is what helped me, and hopefully others:

        git clone git@bitbucket.org:{accountName}/{repoName}.git
    
    0 讨论(0)
  • 2020-11-29 16:16

    Recently I faced the same issue. I got the following error:

    repository access denied. access via a deployment key is read-only.

    You can have two kinds of SSH keys:

    1. For your entire account which will work for all repositories
    2. Per repository SSH key which can only be used for that specific repository.

    I simply removed my repository SSH key and added a new SSH key to my account and it worked well.

    I hope it helps someone. Cheers

    0 讨论(0)
提交回复
热议问题