guice
guice

Reputation: 1094

Using multiple private repos in same vc location

To put it simpley the best I can: we have a private VC repo with a list of composer packages we use internally -- [our-bitbucket.com]/comp/

Each package has it's own repo. Each package is namespaced under [orgname]/ within their composer.json configuration.

What I'm trying to do is clean up this mess:

  "repositories": [
    {
      "type": "vcs",
      "url": "ssh://[email protected]/comp/package1",
      "options": {
        "ssh2": {
          "username": "git",
          "pubkey_file": ".ssh/pub-key",
          "privkey_file": ".ssh/priv-key"
        }
      }
    },
    {
      "type": "vcs",
      "url": "ssh://[email protected]/comp/package2",
      "options": {
        "ssh2": {
          "username": "git",
          "pubkey_file": ".ssh/pub-key",
          "privkey_file": ".ssh/priv-key"
        }
      }
    },
// [... a dozen more times ...]
],

Is there any better and simpler way manage this? This repo list is getting pretty large. We need to clean it up. I don't suppose there's some way to add a global options for the keys? By host?

Upvotes: 0

Views: 217

Answers (1)

guice
guice

Reputation: 1094

Here's a solution I found that assists in cleaning up this file: storing credentials in .ssh/config, modifying the URLs to match the config setting. e.g.

.ssh/config:

Host our-bitbucket.com
    User git
    IdentityFile /root/.ssh/priv-key
# ----------------------------

satis.json

  "repositories": [
    {"type": "vcs", "url": "ssh://[email protected]/comp/package2"},
    //[... dozen more lines ...]
   ]

It at least saves us from having to define a priv/pub key for each and every repo definition.

Upvotes: 1

Related Questions