Activity Team/Git FAQ: Difference between revisions

Use proper name, except in code or URIs
 
(15 intermediate revisions by one other user not shown)
Line 1: Line 1:
<noinclude>{{TeamHeader|Activity Team}}</noinclude>
<noinclude>{{TeamHeader|Activity Team}}</noinclude>
: '''[[Talk:Activity Team/Git FAQ | Post new questions here]]'''.
: '''[[Talk:Activity Team/Git FAQ | Post new questions here]]'''.
==Using gitorious (git.sugarlabs.org)==
==Using GitHub (github.com)==
=== Help! I suddenly can't connect to Gitorious! ===
=== Help! I suddenly can't connect to GitHub! ===
:The [http://osuosl.org/ 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.
:Please contact to [https://github.com/contact GitHub support], or look at [https://help.github.com/ GitHub FAQ]
 
To check if the problem is with your key, try:
 
ssh -v git@github.com
 
A successful ssh setup results in a normal response "Hi! You've successfully authenticated, but GitHub does not provide shell access."


=== How do I create an account on github.com? ===
=== How do I create an account on github.com? ===
Line 17: Line 11:
===How do I migrate a project to GitHub? ===
===How do I migrate a project to GitHub? ===


:Please follow the [[Activity Team/How_to_migrate_from_SugarLabs|instructions here]] to first set up your project's entry in GitHub.
:Please follow the [[Activity Team/How_to_migrate_from_Gitorious|instructions here]] to first set up your project's entry in GitHub.


=== How do I create a new project? ===
=== How do I create a new project? ===


:First set up the project in github as per above.
:First set up the project in GitHub as per above.


:Go to your project directory and type:
:Go to your project directory and type:
Line 41: Line 35:
=== How do I add an additional committer to my project? ===
=== 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".
:Go to: <nowiki>https://github.com/USERNAME/PROJECTNAME/settings/collaboration</nowiki> . Type a username in the box and click "add collaborator"


=== How do I create a fork of an existing project? ===
=== 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".
:Go to project page, and click the "Fork" button in the top


:Note: if you (as maintainer) are making a clone to replace a corrupted mainline on your local machine, you'll need to:
: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
   git clone  git://github.com/username/yourproject.git


:and update [remote] section
:and update [remote] section


  git config remote.origin.url gitorious@git.sugarlabs.org:yourproject/mainline.git
  git config remote.origin.url git@github.com:username/project.git


----
----
Line 59: Line 53:
:in the .git/config file, you may have to change:
:in the .git/config file, you may have to change:
  [remote "origin"]
  [remote "origin"]
     url = git://git.sugarlabs.org/yourproject/yourbranch.git
     url = git://github.com/username/yourproject.git


:to:
:to:
  [remote "origin"]
  [remote "origin"]
     url = gitorious@git.sugarlabs.org:yourproject/yourbranch.git
     url = git@github.com:username/yourproject.git
 


=== How do I request a merge? ===
=== 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".
:Go to your GitHub fork page and follow the steps of the images
 
[[File:Merge-Step1.png]] <br />
Click on the Pull Request button
[[File:Merge-Step2.png]]<br />
You will get something like that
[[File:Merge-Step3.png]]<br />
If you used another branch for changes, just change it in the image
[[File:Merge-Step4.png]]<br />
Click on Create Pull request
[[File:Merge-Step5.png]]<br />
Edit the title/description of the pull request, and click on Create pull request. Now the commiter will review it]]


===What is the difference between a branch and a repository?===
===What is the difference between a branch and a 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.
When you make a clone of a project on GitHub, 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 merge [your repository name]  # This won't work
Line 88: Line 94:
  git rebase master
  git rebase master


===How do I push my branch to gitorious?===
===How do I push my branch to GitHub?===


Use <code>git push origin <your branch name></code>, e.g.,
Use <code>git push origin <your branch name></code>, e.g.,
Line 151: Line 157:




You can also generate a [[#How do I request a merge?|merge request]] on Gitorious from your forked repository to mainline.
You can also generate a [[#How do I request a merge?|merge request]] on GitHub from your forked repository to mainline.


=== How do I send a patch to the Sugar developers? ===
=== How do I send a patch to the Sugar developers? ===
Line 188: Line 194:
=== How do I amend a commit message? ===
=== How do I amend a commit message? ===


If you have "dirty" history (i.e. other patches that are not in mainline
If you have "dirty" history (i.e., other patches that are not in mainline
yet) please create a branch carrying only those two patches and push
yet) please create a branch carrying only those two patches and push
that branch:
that branch:
Line 218: Line 224:
:git-pull does a combination of fetch and merge, so to 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
  git pull git://github.com/username/myproject-clone.git master


=== What is the community protocol for submitting patches? ===
=== What is the community protocol for submitting patches? ===
Line 230: Line 236:
==Internationalization work flow==
==Internationalization work flow==


The i18n work flow involves an interplay between the Pootle server, where translations are maintained and gitorious, where the master POT files are updated. '''Note''': As a maintainer, you may update the .pot file associated with your project, but never update .po files. These are updated for you in the i18n work flow.
{{Note/note|This section is for Gitorious only|The following does not apply to GitHub.}}
 
The i18n work flow involves an interplay between the Pootle server, where translations are maintained and Gitorious, where the master POT files are updated. '''Note''': As a maintainer, you may update the .pot file associated with your project, but never update .po files. These are updated for you in the i18n work flow.


=== How do I get translations for my project? ===
=== How do I get translations for my project? ===
Line 265: Line 273:
  git push -fv
  git push -fv


=== How do I update the Tag field in Gitorious? ===
=== How do I update the Tag field in GitHub? ===


  git tag -m "Release 36" v36 HEAD
  git tag -m "Release 36" v36 HEAD
Line 286: Line 294:


:If you are behind a firewall and need only ''Read-Only'' access to git.sugarlabs.org, you can use HTTP links, like
: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
  https://github.com/username/<project>.git
 
:But if you need commit access, you'll have to set up an SSH proxy tunnel. One option is using [http://www.torproject.org/ Tor]. So, install all requirements:
:But if you need commit access, you'll have to set up an SSH proxy tunnel. One option is using [http://www.torproject.org/ Tor]. So, install all requirements:
* [http://www.torproject.org/ Tor] to make tunnel via Tor network,
* [http://www.torproject.org/ Tor] to make tunnel via Tor network,
Line 294: Line 301:


:Setup your tunnel in SSH. Add the following lines to your ~/.ssh/config
:Setup your tunnel in SSH. Add the following lines to your ~/.ssh/config
  Host git.sugarlabs.org
  Host github.com
     User gitorious
     User git
     ProxyCommand /usr/bin/connect -S 127.0.0.1:9050 git.sugarlabs.org 22
     ProxyCommand /usr/bin/connect -S 127.0.0.1:9050 github.com 22


:Then start [http://www.torproject.org/ Tor], you can just run it on behalf of your account
:Then start [http://www.torproject.org/ Tor], you can just run it on behalf of your account