Skip to main content

Quick tips: Adding an existing project to a drupal.org sandbox

An article from ComputerMinds - Building with Drupal in the UK since 2005
19th Jul 2011

Steven Jones

Senior Developer
Steven Jones
Hey, you seem to look at this article a lot! Why not Bookmark this article so you can find it easily in the future?

Most projects start with you trying out something locally, getting it working and then after some initial testing you might then want to publish the project on Drupal.org. Sandboxes are a great way to throw up some code and the perfect place to pop random code that others might find useful or a project that you just don't want to maintain. If you go and create one on Drupal.org then you'll get helpful instructions for creating a new git repository and creating a basic module to go in the repository and then pushing that code to Drupal.org's servers. But what if you have put your development in a local git repository already? Well, it's really simple to push that code up to a Drupal.org sandbox too, with the minimum of fuss.

Start by adding a remote to your local git repo:


# Replace USERNAME with your git username, and SANDBOX with your sandbox number.
git remote add origin USERNAME@git.drupal.org:sandbox/USERNAME/SANDBOX.git

Then you can push your local master branch into your sandbox by just doing:


git push -u origin master

The -u options means that git will set your branch up to track the remote one, which will make future git pulls and pushes easier.

For extra bonus points, if you've been developing a 7.x version of your project, on a local master branch, but you don't want a master branch on Drupal.org then you could do this push instead:


git push origin master:7.x-1.x

Note that I've not used the -u option here, as I'd probably bring down a tracking branch of the new 7.x-1.x branch next, and delete my local master branch.


git pull --track origin/7.x-1.x
git branch -d master

Hi, thanks for reading

ComputerMinds are the UK’s Drupal specialists with offices in Bristol and Coventry. We offer a range of Drupal services including Consultancy, Development, Training and Support. Whatever your Drupal problem, we can help.