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:
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 -vorigin [email protected]:me/mysite.git (fetch)
origin [email protected]:me/mysite.git (push)GitHub is the origin remote, the default location for git push and git pull.
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 [email protected]:mysite.git
git remote -vorigin [email protected]:me/mysite.git (fetch)
origin [email protected]:me/mysite.git (push)
ac [email protected]:mysite.git (fetch)
ac [email protected]:mysite.git (push)git push --force acNow 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 masterYou can also push the same changes to Cloud Platform:
git push ac masterYour new code is now in both your GitHub and Cloud Platform repositories and is running on your Cloud Platform application.
git pull acFrom svn-18.devcloud.hosting.acquia.com:mysite
* [new tag] 2012-03-12 -> 2012-03-12git push --tagsCloud Platform requires that you keep all of your Drupal application code in the directory 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 docroot directory.
Here is how to make your Cloud Platform code repository available on Bitbucket as well:
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:
[email protected]:[username]/[repo].gitOn your local command line, navigate to your Cloud Platform repository directory and run the following to add a new remote named bitbucket. 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].gitPush all of your code, including branches and tags, to your new Bitbucket remote repository:
git push -u bitbucket --allWhen 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.
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 repository:
[remote "all"]
url = [sitename]@svn-[number].prod.hosting.acquia.com:[sitename].git
url = [email protected]:[username]/[repo].gitYou 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 allJIRA 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.
If this content did not answer your questions, try searching or contacting our support team for further assistance.
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 [email protected]:mysite.git
git remote -vorigin [email protected]:me/mysite.git (fetch)
origin [email protected]:me/mysite.git (push)
ac [email protected]:mysite.git (fetch)
ac [email protected]:mysite.git (push)git push --force acNow 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 masterYou can also push the same changes to Cloud Platform:
git push ac masterYour new code is now in both your GitHub and Cloud Platform repositories and is running on your Cloud Platform application.
git pull acFrom svn-18.devcloud.hosting.acquia.com:mysite
* [new tag] 2012-03-12 -> 2012-03-12git push --tagsCloud Platform requires that you keep all of your Drupal application code in the directory 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 docroot directory.
Here is how to make your Cloud Platform code repository available on Bitbucket as well:
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:
[email protected]:[username]/[repo].gitOn your local command line, navigate to your Cloud Platform repository directory and run the following to add a new remote named bitbucket. 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].gitPush all of your code, including branches and tags, to your new Bitbucket remote repository:
git push -u bitbucket --allWhen 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.
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 repository:
[remote "all"]
url = [sitename]@svn-[number].prod.hosting.acquia.com:[sitename].git
url = [email protected]:[username]/[repo].gitYou 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 allJIRA 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.
If this content did not answer your questions, try searching or contacting our support team for further assistance.