Drupal.org encourages developers to host all of their Drupal-related Open Source code directly on Drupal.org. This is great, because all your OS code will be associated with your account and you will get a lot of extra features such as issue tracking, release publishing, ability to reference other issues and so on. However, current interface of DrupalCore.org website is not the most user friendly, especially when you want to have a quick look at the code of a contrib module.
This is why I think developers should host mirror repositories on another service where the source code can easily be checked through the browser. Why would anyone want to do this? Well, there are dozens of modules that revolve around using one simple hook to achieve certain functionality for example. If you are developing your module, you might want just to check how was that hook used in the contrib module, so you can adjust the code for your project.
To set this up, you will need 2 remote destinations: one on GitHub (or Gitlab, BitBucket, etc.) and the second one on Drupal.org. To keep things simple and self-explanatory, I suggest naming them just like that -
Here's how to set proper destinations:
# Add GitHub source. git remote add github https://YOUR_USERNAME@github.com/YOUR_USERNAME/YOUR_REPO.git # Add Drupal.org source for a full project. git remote add drupal YOUR_GIT_USERNAME@git.drupal.org:project/YOUR_PROJECT.git # OR Add Drupal.org source for a sandbox project. git remote add drupal YOUR_GIT_USERNAME@git.drupal.org:sandbox/YOUR_GIT_USERNAME/PROJECT_NODE_ID.git
Do note that your git username on Drupal.org can be different than the one you use for logging in to Drupal.org. You can check your username by logging to Drupal.org, going to your profile page and then going to "Edit" -> "Git access".
Now when you want to push the code, here's what you need to do;
# Push the code on GitHub. git push github # Push the code on Drupal.org. git push drupal
If for whatever reason you want to push one branch into another (e.g. local
8.x-1.x on Drupal.org), here's how to do that:
git push drupal master:8.x-1.x
Last thing: do bear in mind that contributions by other members are easier to track through issues on Drupal.org. If your project is used by others as well, use Drupal.org issue tracking system to be fair to contributors.