Connecting Cloud IDE to GitHub, Bitbucket or any other code repository
- Last updated
- 1 minute read
Connect Cloud IDE to a non-Acquia Git repository.
Access to Cloud IDE
When you pull your application into Acquia Cloud IDE, we automatically copy your Acquia-hosted codebase, database and files from the Acquia Cloud Platform (via the Cloud Platform API) so that you can start developing Drupal right away.
And of course, you can easily connect your Cloud IDE to Acquia Code Studio with just a few extra commands.
But what if you have a different developer workflow? If you use GitHub, GitLab or Bitbucket, or even another third part source code management service, we’ve got you covered. Setup is straight forward. By simply using Git and SSH, you can quickly set up a connection to any source code management service, and Acquia CLI will make it easy.
Pulling a non-Acquia hosted Git repository into Cloud IDE
Connecting Cloud IDE to a non-Acquia hosted Git repository is easy. But before you can pull your code, Cloud IDE must be granted the permissions to connect to the remote server, so operations remain secure at all times.
At a high level this is how it works:
- Generate an SSH key in Cloud IDE.
- Configure your code management tool by adding the public half of your new SSH key.
- Clone your non-Acquia hosted repository into Cloud IDE.
Generate an SSH key in Cloud IDE
If you’ve already set up your Cloud IDE by following the “Get Started” instructions, skip to the next step.
If you're using a brand new Cloud IDE, first complete the "Get Started" instructions. Click on the CONFIGURE IDE button. This opens up a Terminal window and automatically creates and uploads an SSH key that is associated with your Acquia Cloud Platform account.
Once this is done, you should have a new SSH key pair generated under
/home/ide/.ssh- It takes the form:
- Private key:
- Public key:
As with any SSH key, you should never share the private key with anyone. The public key is meant to be installed on other servers so you can successfully establish a secure connection with your IDE.
- Private key:
Configure your code management tool to add the new SSH key
In this tutorial, we’ll be demonstrating how to add a key with GitHub, but almost identical steps should work with any other vendor.
Print the contents of your Cloud IDE’s public SSH key to the screen and copy it to your clipboard. Here’s an example:
cat /home/ide/.ssh/id_rsa_acquia_ide_6a31f8b5-721a-4w18-969a-06247545befb.pub ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDfRLKksa4bt5csbnDbz7Xzl2Z0abYeLq6o2G5FXyihJLBCj/wB3aWT/wM5buSv+DPi6ZFfCm9LMlpd2VxSJcgiOs/6oUnsDKnw8552piRiYb1huzBSqU3j7mMtn3S+T0xQKVpzKAb0w2DHHYzuy4w/+/+02pslC+594YUjydEidJHAS3wORbkcGQr1rrpn2gj8nEQhUmnwiywnK1QBPd07tdXglJBXtvN+jq1gvdjsInPfU2DnzOnvZ8R6HC9Q9WGQfGLCDq+yS9+d5MRxbZ5VD27pd94RD/1LAjPk6+askMunL8UZTH9XOe9yfxPIpnLVUnOiMgmqnmaHPRjTQGj/AZCtJVNmAE0sDSxS5OHuLpte26nlnyTX+9WoRS8QxHkVy9ubAshsRQfMTh39cxVhUnlvTqvKXuh+iLQkJFn/iBA93gKX33Tr9eP5gxi89DFwfSZakJ6bamF6FGCjZ2Aj3p7wl74xHSCZv5x+XXKatwuLt2XdtqPrp7b+F1sbzL4kowL3xZwoAmhzLOOMYwOjyT/NmfkH9uYnqQj60WoTeZH5eGFpMuhj/irCBPluDxl0oeVcf7M0eL3zqLhhQkYw6j/LF7goNNIDN2oUgF4CbH0SIP11ay/GK/W6ZBqNapbMc5sUNz9p3cX09XTJCG1PYGtmDUS6UoAaBBs2ikYi5w== [email protected]
GitHub has an excellent documentation page to add a new SSH key to your GitHub account. In a nutshell, visit https://github.com/settings/ssh/new and paste your key there. Give it a meaningful name so you remember it weeks from now.
Clone your non-Acquia hosted repository into Cloud IDE
Your Cloud IDE is now able to establish an SSH connection to your GitHub repository. so you can easily clone your repository.
/home/ide/projectand ensure the directory is empty. Then, clone your GitHub repository. Here’s an example:
git clone [email protected]:margaret/margaret.git . Cloning into '.'... Warning: Permanently added the ECDSA host key for IP address '22.214.171.124' to the list of known hosts. remote: Enumerating objects: 40, done. remote: Counting objects: 100% (40/40), done. remote: Compressing objects: 100% (33/33), done. remote: Total 40 (delta 1), reused 0 (delta 0), pack-reused 0 Receiving objects: 100% (40/40), 1.74 MiB | 16.49 MiB/s, done. Resolving deltas: 100% (1/1), done.
Congratulations, you made it here!
Pull your database and files into Cloud IDE
Now that your codebase is available in Cloud IDE, one last step you might wonder about is how to only pull your database and files directory? There again we have your back!
From your Cloud IDE’s “Get Started” page, you can click on the “database and files” link just below the COPY FROM THE CLOUD PLATFORM button. This instructs Acquia CLI to only pull your database and files while omitting the codebase, which is exactly what we need.
As you can see, Acquia Cloud IDE is simple and flexible to adapt to your preferred developer workflow.
Alternatively, you can also directly run Acquia CLI commands to pull down the Drupal files and database from your Cloud application:
acli pull:db acli pull:files
Create 1 for free today or request a demo!