Contributing to Projects on GitHub all You Need is a Fork

Written by James McDonald

August 1, 2014

Today I did my first attempt at committing some code to an open source project named xtuple, specifically the javascript part that supports the xtuple-mobile client

After posting a query about a translation issue on the xTuple forums the next comment basically gave me the whole answer but suggested I contribute the fix. So I did.

So the basic steps.

  1. Fork the project to my own github account
  2. Clone this repository to my local computer and configure git with my details
    git clone xtuple-jmcd73
    cd xtuple-jmcd73
    git config --global "James McDonald"
    git config --global [email protected]
  3. Add my github xtuple  instance as a remote
    git remote add jmcd73 [email protected]:jmcd73/xtuple.git
  4. Locally make the change to the file and commit
    # create a branch and switch to it
    git branch en_AU-fix
    git checkout en_AU-fix
    # do edits to file and then add and commit
    git add scripts/lib/build_dictionary.js
    git commit -m "change build_dictionary.js ... commit comment"
  5. push to my forked xtuple repository
    git push jmcd73 en_AU-fix
  6. Work around getting (public key) access denied issue because I didn’t have ssh-agent running locally and I had no .ssh key configured on git hub.
    # get the agent running
    eval "$(ssh-agent -s)"
    # create a key (only needed if you don't have one already)
    # add a key
    ssh-add ~/.ssh/id_rsa
    # check it's loaded
    ssh-add -l
    2048 af:35:a8:e1:cd:d0:bc:9d:72:55:be:zz:80:bf:ed:80 /home/jmcd/.ssh/id_rsa (RSA)
  7. Add the contents of ~/.ssh/ to github under Account Settings ==> SSH Keys
  8. Finally once you have successfully added a change to your personal fork go to the main project page and click Submit Pull Request. The parent project detects you have done the fork and committed changes so the button is prominent.
  9. Done


Once you have the fix installed into xTuple

I did the following

cd /home/vagrant/source/xtuple

root@xtuple-server:/home/vagrant/source/xtuple# scripts/export_dictionary.js -l en_AU -d test
Exporting to /home/vagrant/source/xtuple/scripts/output/en_AU_dictionary.js

Then you will have a file en_AU_dictionary.js in scripts/output/ (you may need to mkdir scripts/output as this didn’t exist when I tried and it failed)

The file has the translation in the javascript key named target:

  "language": "en_AU",
  "extensions": [
      "extension": "_core_",
      "strings": [
          "key": "_abbreviation",
          "source": "Abbreviation",
          "target": "Abbreviation"
          "key": "_abbreviationLong",
          "source": "Abbreviation Long",
          "target": "Abbreviation Long"
        // ...

Then you just have to import it to the correct database which in my case is named test.

./scripts/import_dictionary.js -f scripts/output/en_AU_dictionary.js -d test

The code I changed is here


Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

You May Also Like…