3

I have an ec2 instance running on AWS. Aegir installed and drush make works perfect for installing new platforms except when I need to download a theme from a private github repository.

drush make doesn't have access to the github private repository and fails the platform install.

How do I overcome this? Is there some fancy way to give drush make or the aegir user ssh keys for the git repository?

I don't know much about ssh-agent, but I figured maybe getting that to run all the time on my server so aegir will have access to my github.

how to make drush make access a private github repository?

Jeremy Iglehart
  • 4,281
  • 5
  • 25
  • 38

2 Answers2

1

Generate an SSH key on the EC2 instance, then add the public key (usually id_rsa.pub) to the private repository as a deoploy key.

stevenh512
  • 545
  • 2
  • 8
1

stevenh512 is right,a step by step explanation follows:

Disclaimer: I use GitLab + custom VPS on Centos but the same workflow can be applied on any hosting (with ssh) and GitHub (ps I love GitLab for private repos)

  1. Login to VPS as aegir, probably you can’t (if you configure your server tightly secure) so login as root an su aegir

  2. Go to home dir (cd /var/aegir) and check is you have an SSH key. If you have one jump 1 step.

    cat ~/.ssh/id_rsa.pub
    
  3. If you don’t have create one and don’t use a pass-phrase (for more info http://community.aegirproject.org/node/30#SSH_keys but there are solutions if you want a pass-phrase). After the creation you will have the key’s random image. (Study the SSH it's too important for security!)

    ssh-keygen -t rsa
    
  4. Copy the key and then go to you GitHub/Lab->account/profile settings->SSH keys->Add SSK key. For title give anything you want (like: Aegir Key) and for key paste the key from your server.

    cat ~/.ssh/id_rsa.pub
    
  5. Now back to server you must add the Git as known host, we go the easy way: just login with ssh and type yes when it will ask for connection. Ready!!

    ssh git@github.com
    - or -
    ssh git@gitlab.com
    
  6. Testing: make a .make file and save it somewhere public (like Dropbox, right click copy public url) like:

    core = 7.x
    api = 2
    projects[drupal][version] = 7.26
    projects [my_module_name][type] = "module"
    projects [my_module_name][download][type] = "git"
    projects [my_module_name][download][url] = "git@gitlab.com:my_repo.git"
    projects [my_module_name][download][branch] = "master"
    
  7. Go to aegir gui and create an new platform and wait for verification (otherwise you can ssh as aegir to the server and test it with drush make url.make folder)

Warning! This workflow isn’t the most secure! Just experiment with it and configure proper your server!

Info: This workflow also works for your local dev machine (linux, mac, cygwin) to play with private repositories on GitHub and GitLab

tvl
  • 3,868
  • 2
  • 16
  • 35