18

I have multiple private repos in Bitbucket, and sometimes need to grant read/write access to one of them on some server.

I can add the public key to my user account, but I don't want that key to have access to all of my repos.

If I make a deployment key, it has only read access on the specified repo.

Is there a way to have write access with a specific key on a specific repo?

halfer
  • 19,824
  • 17
  • 99
  • 186
Ricardo Martins
  • 5,702
  • 3
  • 40
  • 59

3 Answers3

11

All write access to Bitbucket repositories is managed based on Bitbucket users. So if you don't want to give your normal Bitbucket users write access, then you need to create an additional Bitbucket user.

Since Bitbucket bill you by the number of users I don't see anything wrong in doing this — infact, it's in their interest that you create several users.

Martin Geisler
  • 72,968
  • 25
  • 171
  • 229
  • 1
    Yes Martin, you are right. If I cold create a write-user with any key, they cant sell their plans. =] – Ricardo Martins Aug 27 '12 at 16:52
  • 3
    This is very insecure for users with multiple machines. This means that I have to grant any machine I use to work on *a* repository access to *all* of my repositories. At least they should allow me to restrict my user keys to specific repositories. – Him Jul 31 '18 at 16:25
2

I met the same issue, I've found related issue in bitbucket public issue tracker. https://bitbucket.org/site/master/issues/6887/additional-read-write-key-per-repository

One of the comments:

I am afraid we are not going to do this. This would mess up the way we do billing on the site. We could a user as someone with write access to a repository. There are ways around this, setting up another account with that key and only giving that user access to the repos you require.

Nodarii
  • 934
  • 7
  • 21
1

If you only need access to the repository while logged it, you could use the ForwardAgent setting in your ssh config:

How to forward local keypair in a SSH session?

lassej
  • 6,256
  • 6
  • 26
  • 34