Contribute Your Code on Drupal.org, Part 3: Git Configuration
Welcome to Part 3 of our series on contributing your code to Drupal.org. In previous sections, we talked about the setting up the basics of your project.
{snippet drupalcontributionlinks}
In this article, we’ll get started with the Git setup.
Drupal.org prefers users to submit projects via Git.
You might say that Git commits is the currency used on Drupal.org. The Drupal community wants you to build up a record of commits. The more code you commit, the more trust and privileges you will enjoy on Drupal.org.
Here’s how to get started with Git on Drupal.org:
- Go to your Account page.
- Click the “Profile” tab.
- Click the “Edit” tab in the submenu.
- In the submenu, go to the “Git access” tab:
- You must accept the “Git access agreement” in order to proceed:
Now we need to setup Git. This will require you to use a command line terminal. In this tutorial, we assume you know about Git and using the command line. If you don’t, watch the “Introduction to the Command Line” class, plus the Git and Version Control classes.
In your terminal enter the following:
git config --global user.name "your-username-@-drupal"
git config --global user.email your-email@gmail.com
or if you prefer not to give your email:
git config --global user.email your-username@3285813.no-reply.drupal.org
We need to make some basic recommended Git changes. Below is a list of commands that sets colors. This will make files in different stages show up in different colors to differentiate them.
git config --global user.name "your name"
git config --global color.status auto
git config --global color.branch auto
git config --global color.interactive auto
git config --global color.diff auto
git config --global push.default tracking
git config --list
config –list, should show all the configuration options you have set. You can also run git status to check everything is working fine. I recommend you do this now as you will not be able to proceed if Git is not working.
Now if we go back to your Profile, Your Projects, you should see the Sandbox projects you have active. You will see below that we have made a Project called “Breeze a drupal 8 theme”: