Activity Team/Git FAQ

< Activity Team
Revision as of 10:00, 17 September 2010 by Walter (talk | contribs)

Team Home   ·   Join   ·   Contacts   ·   Resources   ·   FAQ   ·   Roadmap   ·   To Do   ·   Meetings

Post new questions here.

Using gitorious (git.sugarlabs.org)

Help! I suddenly can't connect to Gitorious!

The OSUOSL, which hosts Gitorious, has an aggressive IP blacklist policy. If you once were able to push but now cannot, send an email to support@osuosl.org requesting that your IP be removed from the blacklist.

To check if the problem is with your key, try:

ssh -v gitorious@git.sugarlabs.org

A successful ssh setup results in a normal response "Need SSH_ORIGINAL_COMMAND" then connection is closed.

How do I create an account on git.sugarlabs.org?

Register using the link on the upper right menu on the Home Page.

How do I migrate a project to git.sugarlabs.org?

Please follow the instructions here to first set up your project's entry in Gitorious.

How do I create a new project?

First set up the project in gitorious as per above.
Go to your project directory and type:
git init
git add .
git commit -a
git remote add origin gitorious@git.sugarlabs.org:[your project name]/mainline.git
git push origin master
Hence forth, just use:
git commit
git push
You can also use
git commit -a -m "I am the commit message"
to avoid opening an editor.

How do I add an additional committer to my project?

Click on the Repositories Tab of the project page in Gitorious. Click on "Mainline". A link will appear on the right-hand side of the page saying, "Add Committer".

How do I create a fork of an existing project?

Click on the Repositories Tab of the project page in Gitorious. Click on "Mainline". A link will appear on the right-hand side of the page saying, "Clone repository".
Note: if you (as maintainer) are making a clone to replace a corrupted mainline on your local machine, you'll need to:
 git clone  git://git.sugarlabs.org/yourproject/mainline.git
and update [remote] section
git config remote.origin.url gitorious@git.sugarlabs.org:yourproject/mainline.git

in the .git/config file, you may have to change:
[remote "origin"]
    url = git://git.sugarlabs.org/yourproject/yourbranch.git
to:
[remote "origin"]
    url = gitorious@git.sugarlabs.org:yourproject/yourbranch.git

How do I request a merge?

Click on the Repositories Tab of the project page in Gitorious. Click on "Mainline". A link will appear on the right-hand side of the page saying, "Request merge".

Branch vs Repository

When you make a clone of a project on gitorious, it creates a "repository". You can see the list of repositories associated with a project by clicking on the Repository Tab. Branches are clones within a repository (created with git branch and accessed through git checkout). Git merge commands refer to branches, not repositories, so in order to merge a repository back into mainline, you need to pull (fetch followed by merge) it as if it were a patch.

git merge [your repository name]   # This won't work
git pull [your project name/[your repository name].git master  # This will work

How do I select which branch I am working on?

git checkout master
git checkout sucrose-0.84

How do I merge changes from master into a branch?

git checkout sucrose-0.84
git rebase master

Patches

As a maintainer, how do I merge a patch?

git-pull does a combination of fetch and merge, so to merge a patch...
git pull git://git.sugarlabs.org/myproject/myproject-clone.git master

How do I send a patch to a maintainer?

An easy way to send a complete patch is to commit in git, then do:

git format-patch -s -1
git send-email --to <maintainer> --cc <mailing-list> <filename>

How do I generate a patch?

git diff > blah.patch
or
diff -rup [old] [new]
or
git format-patch HEAD^

It is preferable that you generate your patch from the root directory of your project.

How do I send a patch to the developers?

git send-email --to=sugar-devel@lists.sugarlabs.org 0001*.patch

You may need to install git-mail:

sudo yum -y install git-email

Internationalization work flow

How do I get translations for my project?

  1. Use the gettext mechanism for your stings.
  2. Use python setup.py genpot to generate a .pot file for your project.
  3. Fill a ticket requesting that your POT file be added to Pootle. Assign the ticket to "Localization".
  4. Add User Pootle to the list of committers on your project.

How do I stay in sync with translations being pushed from the Pootle server?

Periodically—in my experience, on Fridays—updates to the project .po files are pushed from the Localization team.
Use git-pull to periodically pull these updates to the local copy of your project.
Also, run python setup.py fix_manifest to update the .mo files after updating the .po files
Note: After every major release, a new branch is created on the Pootle server, e.g., Fructose-0.82 and Fructose-0.84. The Localization team may push translations to any or all of the corresponding branches of your project. Changes to your master branch are not necessarily intended for the release branches.

How do my string changes get into Pootle?

Any changes to your project's .pot file are daily pulled into Pootle from git. All you have to do as a developer is make to regenerate your pot file whenever you make string changes.

setup.py genpot
git commit po/Myproject.pot -m "new strings"
git push

Misc.

What if my project has a binary blob?

You may have to use the --force flag.
git push -fv

How do I update the Tag field in Gitorious?

git tag -m "Release 36" v36 HEAD
git push --tags

Commit access behind firewall

If you are behind a firewall and need only Read-Only access to git.sugarlabs.org, you can use HTTP links, like
http://git.sugarlabs.org/git/<project>/mainline.git
But if you need commit access, you'll have to set up an SSH proxy tunnel. One option is using Tor. So, install all requirements:
  • Tor to make tunnel via Tor network,
  • connect to let SSH use this tunnel.
You don't need any special configs for this software (in case of Tor, if your distribution makes some smart pre-configurations, just remove /etc/tor/torrc).
Setup your tunnel in SSH. Add the following lines to your ~/.ssh/config
Host git.sugarlabs.org
    User gitorious
    ProxyCommand /usr/bin/connect -S 127.0.0.1:9050 git.sugarlabs.org 22
Then start Tor, you can just run it on behalf of your account
tor
Then do the regular stuff you can do without any firewalls.
NOTE: If you use Tor on a regular basis, please consider the possibility of helping Tor by donating your bandwidth.

Commits are not visible on git.sugarlabs.org event pages

Check that your email address on git.sugarlabs.org account page is the same like in global git settings or in local repository setting (if you set user.email once):

git config user.email

New activity maintainer walkthrough

Here's an IRC session recording the very first steps of new activity maintainer learning how to merge patches:

Activity_Team/Git_Activity_Maintainer_Walkthrough