Activity Team/Git Tutorial: Difference between revisions

No edit summary
No edit summary
Line 1: Line 1:
<noinclude>{{GoogleTrans-en}}{{TeamHeader|Activity Team}}{{TOCright}}</noinclude>
<noinclude>{{GoogleTrans-en}}{{TeamHeader|Activity Team}}{{TOCright}}</noinclude>
== Gitorious ==
== Gitorious ==


Getting started with Gitorious.
Getting started with Gitorious, a web based Git service used by Sugar Labs.


=== Create an account ===
=== Create an account ===
Create an account on git.sugarlabs.org by selecting the register link on the home page.
Create an account on git.sugarlabs.org by selecting the ''register'' link on the page.


Enter your
Enter your
Line 13: Line 14:
*Password confirmation
*Password confirmation


Follow link on email confirmation
Gitorious sends you a confirmation mail.  Check your email, wait for the confirmation, and follow the link provided.


=== Create SSH Key ===
=== Create SSH Key ===
Line 29: Line 30:
  -rw-r--r--  1 strom strom  603 2009-12-17 21:51 id_dsa.pub
  -rw-r--r--  1 strom strom  603 2009-12-17 21:51 id_dsa.pub


Log in to http://git.sugarlabs.org/account and upload you public key. In your account you can find a link named <tt>Add SSH key</tt>. You can paste your public key directly to the input field.
Log in to http://git.sugarlabs.org/account and upload you public key. In your account you can find a link named <tt>Add SSH key</tt>. You can paste your public key directly to the input field.


With ssh-keygen you can specify the name of your key file. Using this feature is no good idea. Keys should generally located in <tt>~/.ssh/id_rsa.pub</tt> or <tt>~/.ssh/id_dsa.pub</tt>.
(With ssh-keygen you can specify the name of your key file. Using this feature is not a good idea, because we haven't tested it. Keys should generally be located in <tt>~/.ssh/id_rsa.pub</tt> or <tt>~/.ssh/id_dsa.pub</tt>.)


ToDo: Does keys protected with a passphrase work together with GIT?
ToDo: Does keys protected with a passphrase work together with GIT?


ToDo: What is the difference between DSA and RSA keys?
ToDo: What is the difference between DSA and RSA keys?
* until the patent expired, RSA could not be used in some countries,
* some countries have laws against consumer use of encryption.


=== Create a Project ===  
=== Create a Project ===  


Created a new project by selecting the new link on the project page.
Created a new project by selecting the ''new'' link on the project page.


Enter your
Enter your
*Project Title
*Project Title
*Project slug (This a filled in for you based on your project title
*Project slug (this defaults to a file name format of your project title)
*License
*License
*Description
*Description


There several other question which can be answered later as you have more information.
There several other question which can be answered later as you have more information.
Once this step is done, Gitorious has created a git repository at Sugar Labs.
=== Create Local Repository ===
Clone it from Gitorious:
git clone gitorious@git.sugarlabs.org:<slug>/mainline.git <slug>.git
Replace ''<slug>'' substring with your project slug value.


=== Initialize git global settings ===
=== Initialize git global settings ===
Git must know your email and name.  It uses this when you push or mail a change.
If you do not use git on your system for any other project, you can configure git:


  git config -f ~/.gitconfig user.email <email-you-used-for-registering-project>
  git config -f ~/.gitconfig user.email <email-you-used-for-registering-project>
  git config -f ~/.gitconfig user.name <your-name>
  git config -f ~/.gitconfig user.name <your-name>


=== Create Local Repository ===
Otherwise, configure git in the repository after cloning below:
 
git config user.email <email-you-used-for-registering-project>
git config user.name <your-name>
 
=== Add source files or change existing files ===


There are two way to create a local repository.  Initial one from scratch using git commands or pull your new project from Gitorious.
=== Commit changes ===


==== Initialize blank repository ====
=== Request review of changes ===
Make a directory for your project, and copy your source files there. Change to the project directory and run:


  git init
  git format-patch -1


==== Pull from Gitorious ====
or


One of the easiest way to create a local git repository which it set up to point to your new Gitorious project is to 
git send-email


=== Push project ===
=== Push changes ===


Replace ''<slug>'' substring with your project slug value
Your changes have to be pushed from your local repository to git.sugarlabs.org so that others can see them.


git remote add origin gitorious@git.sugarlabs.org:<slug>/mainline.git
# to push the master branch to the origin remote we added above:
git push origin master
# after that you can just do:
  git push
  git push


To find the push URL, visit the Gitorious page for the project.  Example: http://git.sugarlabs.org/projects/turtleart/repos/mainline
=== Pull changes ===
 
Others, including pootle, may add changes to the repository at git.sugarlabs.org.  You must merge these with your repository.


Use
Use