If you use Git, you may want to host your Git repository at GitHub or on Bitbucket to take advantage of their excellent Git support, pull requests with integrated code review, and use other features. The following methods are available to keep your application’s code in GitHub or Bitbucket while still hosting it on Cloud Platform:
Pipelines provides integration with GitHub, Bitbucket, and the Cloud Platform interface.
Manually creating two remotes for your local repository clone: one at GitHub or Bitbucket, and one at Cloud Platform.
The first step is to create two remote repositories. Suppose you have an existing repository at GitHub containing your application’s code. Use the following commands to make a local clone:
git clone [email protected]:me/mysite.git cd mysite git remote -v
GitHub is the origin remote, the default location for
git push and
To deploy this code to Cloud Platform, add your Cloud Platform repository as an
additional remote, named something short, like
ac, and then do an initial
git push --force ac to reinitialize the Cloud Platform repository. You can
find the URL of your Cloud Platform repository in the Cloud Platform interface,
using Application info panel.
git remote add ac mys[email protected]:mysite.git git remote -v
git push --force ac
Now you have two remotes,
origin (GitHub) and
ac (Cloud Platform).
After you have set up your two remote repositories, keep them in sync by pushing local changes to both GitHub and Cloud Platform. You can edit some files and push them to GitHub:
vi somefile.php git add somefile.php git commit -m 'edited somefile.php' git push origin master
You can also push the same changes to Cloud Platform:
git push ac master
Your new code is now in both your GitHub and Cloud Platform repositories and is running on your Cloud Platform application.
Cloud Platform requires that you keep all of your Drupal application code in
docroot in your repository. Your existing GitHub repository
may not be set up that way, and you may have a lot of commit history in that
repository that you want to preserve. To preserve your GitHub repository’s
directory structure and commit history, you can use
git subtree to
translate your GitHub repository’s root directory into a Cloud Platform
Here is how to make your Cloud Platform code repository available on Bitbucket as well:
Create an account on bitbucket.org. Bitbucket offers unlimited private repositories for free for up to five users. During the account creation process, select the empty repository option and provide it with a name.
Once your account has been created and your empty repository is provisioned, add your SSH public key to Bitbucket under your account settings. You can either use an existing key or generate a new key pair for Bitbucket use only.
On your Bitbucket repository overview page, under Command line, click I have an existing project and copy the remote URL, which should appear similar to the following:
On your local command line, navigate to your Cloud Platform repository
directory and run the following to add a new remote named
Of course, you’ll need to replace the
git@bitbucket location with the
actual one you copied from your repository overview page; you can also name
the new remote whatever you’d like:
git remote add bitbucket [email protected]:[username]/[repo].git
Push all of your code, including branches and tags, to your new Bitbucket remote repository:
git push -u bitbucket --all
When prompted for a password, which is only necessary the first time you connect, enter your actual Bitbucket account password before you proceed with the push.
When you refresh your repository overview on Bitbucket, you should now see all of your code and commits.
If you want to keep your Cloud Platform and Bitbucket repositories in sync,
create a new alias named
all in the
.git/config file in your
[remote "all"] url = [sitename]@svn-[number].prod.hosting.acquia.com:[sitename].git url = [email protected]:[username]/[repo].git
You can find the URL of your Cloud Platform repository in the Cloud Platform interface’, using the Application info panel.
When you push new commits, use the
all alias to push simultaneously code to
both Cloud Platform and Bitbucket:
git push all
JIRA is Atlassian’s issue tracking and project management software. For information about how to connect your remote Bitbucket or GitHub repository to JIRA, see Atlassian’s documentation.