Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Allow CI access to private BitBucket repo

I'm running a CI machine on AppCenter and need to allow read/write access to a private BitBucket repository but I can't figure out how to do this.

My approach is to create an ssh key and during CI builds add the private key to the machine ssh-agent using ssh-add -K (mac machine).

I've created an ssh key on my local computer (mac) using ssh-keygen and uploaded the .pub key to BitBucket. Then as my CI runs I'm trying to take the private key and add it to the ssh-agent but I'm being prompt to enter a password and can't figure out how to inject it in a non-interactive shell mode.

Is this the right approach to grant access to BitBucket in CI? if so, how can I add an ssh key without being prompt to enter a password?

  • Scripts are in Ruby or Bash.
  • The repo contains certificates used for Fastlane Match
like image 493
Shachar Avatar asked Nov 23 '25 05:11

Shachar


1 Answers

Answering my own question...

I ended up using BitBucket AppPasword and cloning via https. I think there has to be a better way but this work for my needs at the moment.

I needed access from my CI to a private BitBucket certificates repo to use with Fastlane Match, the value in my MatchFile forgit_url that allows me to clone the repo is:

git_url "https://{BITBUCKET_USER}:{BITBUCKET_APP_PASSWORD}@bitbucket.org/{BITBUCKET_USER}/{REPO}.git"

You can obtain a bitbucket app password by clicking your profile (Avatar) -> Settings -> App Passwords

like image 197
Shachar Avatar answered Nov 26 '25 06:11

Shachar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!