Difference between revisions of "Git"

From Eclipsepedia

Jump to: navigation, search
(Add section for https push config)
Line 1: Line 1:
<div style="border: thin solid black; background-color: #F4FFF4; margin: 3px"><div style="margin: 4px">
+
<div style="border: thin solid black; background-color: rgb(244, 255, 244); margin: 3px;"><div style="margin: 4px;">
This page is a work in progress, and is not yet complete. Not every project has a Git repository -- just like not every project has an SVN or CVS repository.
+
This page is a work in progress, and is not yet complete. Not every project has a Git repository -- just like not every project has an SVN or CVS repository.  
</div></div>
+
</div></div>
 +
<br>  
  
 +
== Git mirrors of CVS repositories  ==
  
== Git mirrors of CVS repositories ==
+
The CVS repositories at Eclipse.org are being mirrored to read-only Git repositories. Please see the [http://dev.eclipse.org/git/ git repositories page] for the full list of repositories. Please note that Git mirrors will be deleted for those projects that migrate to Git.
  
The CVS repositories at Eclipse.org are being mirrored to read-only Git repositories. Please see the [http://dev.eclipse.org/git/ git repositories page] for the full list of repositories.  Please note that Git mirrors will be deleted for those projects that migrate to Git.
+
== Git repositories  ==
  
== Git repositories ==
+
Eclipse projects may use either CVS, SVN or Git. The project you are looking for may not be using Git. Please see [[CVS Howto]] and [[SVN Howto]] for more information. If you are unsure which type of repository a project is using, please go to that project's home page.  
Eclipse projects may use either CVS, SVN or Git. The project you are looking for may not be using Git. Please see [[CVS_Howto]] and [[SVN_Howto]] for more information. If you are unsure which type of repository a project is using, please go to that project's home page.
+
  
=== My Eclipse project wants to use Git ===
+
=== My Eclipse project wants to use Git ===
* New projects may choose Git as their repository in the [http://www.eclipse.org/projects/project_provisioning_request.php New Project Provisioning Request].
+
* Existing projects may migrate to Git from SVN or CVS.  Please see [[Git/Migrating to Git]] for more details.
+
  
=== Migrating from CVS/SVN to Git ===
+
*New projects may choose Git as their repository in the [http://www.eclipse.org/projects/project_provisioning_request.php New Project Provisioning Request].
Please see [[Git/Migrating to Git]].
+
*Existing projects may migrate to Git from SVN or CVS. Please see [[Git/Migrating to Git]] for more details.
 +
 
 +
=== Migrating from CVS/SVN to Git ===
 +
 
 +
Please see [[Git/Migrating to Git]].  
 +
 
 +
=== Committers new to Git  ===
 +
 
 +
Before working on a Git repository, please:
 +
 
 +
*Read [http://wiki.freegeek.org/index.php/Git_for_dummies Git for Dummies]
 +
*Have the [http://wiki.sourcemage.org/Git_Guide Git Guide] handy
 +
*Note that anyone can commit to '''their''' repo, but only Eclipse committers can push their repo to git.eclipse.org
 +
*'''DON'T FORGET to configure your git environment'''
  
=== Committers new to Git ===
 
Before working on a Git repository, please:
 
* Read [http://wiki.freegeek.org/index.php/Git_for_dummies Git for Dummies]
 
* Have the [http://wiki.sourcemage.org/Git_Guide Git Guide] handy
 
* Note that anyone can commit to '''their''' repo, but only Eclipse committers can push their repo to git.eclipse.org
 
* '''DON'T FORGET to configure your git environment'''
 
 
     git config --global user.email my_committer_email@address.com
 
     git config --global user.email my_committer_email@address.com
 
     git config --global user.name "John Doe"
 
     git config --global user.name "John Doe"
* Note that the above will set this as the default user name and email address to use when writing commits. You can set user.name and password on a per repository basis.
+
 
 +
*Note that the above will set this as the default user name and email address to use when writing commits. You can set user.name and password on a per repository basis.
  
 
     git config user.email my_committer_email@address.com
 
     git config user.email my_committer_email@address.com
 
     git config user.name "John Doe"
 
     git config user.name "John Doe"
  
This will set the username and email address on just the current git repository.
+
This will set the username and email address on just the current git repository.  
  
=== List of Git repositories available ===
+
=== List of Git repositories available ===
  
Please connect to http://git.eclipse.org/
+
Please connect to http://git.eclipse.org/  
  
=== Connecting, cloning a repo ===
+
=== Connecting, cloning a repo ===
Please see the list of Git repositories (above).
+
 
 +
Please see the list of Git repositories (above).  
 +
 
 +
Committer access:
  
Committer access:
 
 
     git clone ssh://committer_id@git.eclipse.org/gitroot/project/repo
 
     git clone ssh://committer_id@git.eclipse.org/gitroot/project/repo
 
     git clone https://committer_id@git.eclipse.org/gitroot/project/repo (if enabled for your repository)
 
     git clone https://committer_id@git.eclipse.org/gitroot/project/repo (if enabled for your repository)
Committer access via https is disabled (and discouraged), but it is available.  Please ask Webmaster if you absolutely need commit access over https.
 
  
 +
Committer access via https is disabled (and discouraged), but it is available. Please ask Webmaster if you absolutely need commit access over https.
 +
 +
<br> Anonymous, read-only access:
  
Anonymous, read-only access:
 
 
     git clone git://git.eclipse.org/gitroot/project/repo
 
     git clone git://git.eclipse.org/gitroot/project/repo
 
     git clone http://git.eclipse.org/gitroot/project/repo
 
     git clone http://git.eclipse.org/gitroot/project/repo
  
Examples:
+
Examples:  
 +
 
 
     git clone ssh://droy@git.eclipse.org/gitroot/babel/org.eclipse.babel.server.git
 
     git clone ssh://droy@git.eclipse.org/gitroot/babel/org.eclipse.babel.server.git
 
     git clone git://git.eclipse.org/gitroot/babel/org.eclipse.babel.server.git
 
     git clone git://git.eclipse.org/gitroot/babel/org.eclipse.babel.server.git
  
=== Committing and pushing ===
+
=== Committing and pushing ===
[[Image:Git.png|thumb|The wrong way]]
+
  
[[Image:Git-correct.png|thumb|The right way]]
+
[[Image:Git.png|thumb|The wrong way]]  
Before committing code to your cloned repo, please ensure that your Git environment is properly set.  Otherwise, the email address stored in the commit transaction in your repository will not match the email address of your Eclipse Committer record with the Eclipse Foundation, and your push will fail.
+
  
=== Notes on DVCS ===
+
[[Image:Git-correct.png|thumb|The right way]] Before committing code to your cloned repo, please ensure that your Git environment is properly set. Otherwise, the email address stored in the commit transaction in your repository will not match the email address of your Eclipse Committer record with the Eclipse Foundation, and your push will fail.  
Due to our rigorous IP process, the Eclipse.org use-case for a DVCS is different than that of other Open Source organizations. For this reason, an update hook is installed '''and must remain in place''' on every Git repository to ensure a clean IP provenance.
+
  
The Eclipse update hook will examine the '''Committer''' entries of an incoming push. All the committer entries '''must''' be made by the committer performing the push, or the push will fail. Furthermore, your committer ID, or the committer email address registered with your committer account at the Eclipse Foundation must be present in the Committer Email record. Here are some scenarios to help understand this restriction:
+
=== Notes on DVCS  ===
 +
 
 +
Due to our rigorous IP process, the Eclipse.org use-case for a DVCS is different than that of other Open Source organizations. For this reason, an update hook is installed '''and must remain in place''' on every Git repository to ensure a clean IP provenance.
 +
 
 +
The Eclipse update hook will examine the '''Committer''' entries of an incoming push. All the committer entries '''must''' be made by the committer performing the push, or the push will fail. Furthermore, your committer ID, or the committer email address registered with your committer account at the Eclipse Foundation must be present in the Committer Email record. Here are some scenarios to help understand this restriction:  
  
 
     '''Scenario 1'''
 
     '''Scenario 1'''
Line 90: Line 102:
 
       Committer can push their committed code to us, preserving the Author information in the transaction.
 
       Committer can push their committed code to us, preserving the Author information in the transaction.
  
=== Creating a new repository ===
+
=== Creating a new repository ===
Webmaster can create a new repository for you. Just [https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Community&component=Git open a bug] against Eclipse Foundation > Community > Git. However, Eclipse committers with shell accounts can create new repositories:
+
 
 +
Webmaster can create a new repository for you. Just [https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Community&component=Git open a bug] against Eclipse Foundation &gt; Community &gt; Git. However, Eclipse committers with shell accounts can create new repositories:  
  
 
     initrepo /gitroot/project/org.eclipse.repo.name.git
 
     initrepo /gitroot/project/org.eclipse.repo.name.git
  
For consistency, the name of the repository '''must''' end with .git.
+
For consistency, the name of the repository '''must''' end with .git.  
 +
 
 +
=== Permanently deleting code from Git  ===
 +
 
 +
If you are required to permanently remove code from a Git repository, please open a bug against [https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Community&component=Git Community/Git] and Webmaster will do this for you.
 +
 
 +
=== Setting up ssh keys  ===
 +
 
 +
['''This doesn't work unless you are a project lead or are granted a proper shell to work in (only project leads at the moment). See [https://bugs.eclipse.org/bugs/show_bug.cgi?id=312034 bug 312034].''']
 +
 
 +
To avoid having to type in your password for each interaction with the server when using git from the command line:
 +
 
 +
*Generate a public/private key pair if you don't already have one on your own machine
 +
*sftp committer_id@git.eclipse.org and transfer the id_xxx.pub files from your .ssh directory
 +
*ssh committer_id@git.eclipse.org
 +
*mkdir .ssh
 +
*chmod 755 .ssh
 +
*cd .ssh
 +
*cat ../id_xxx.pub &gt;&gt;authorized_keys (for each .pub file you transferred)
 +
*chmod 755 authorized_keys
 +
 
 +
['''At the moment, sftp is blocked, and using scp works, but you cannot run the mkdir command so cannot put the *.pub files into authorized_keys.''']
 +
 
 +
=== Setting up https for pushing<br> ===
  
=== Permanently deleting code from Git ===
+
Here is a sample ''.gitconfig'' file which is used for '''git push''' via https. It is expected to be into your user's system directory (e.g. for Windows Vista "''C:\Users\dtenev\.gitconfig''").<br>
If you are required to permanently remove code from a Git repository, please open a bug against [https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Community&component=Git Community/Git] and Webmaster will do this for you.
+
<pre>[core]
 +
        repositoryformatversion = 0
 +
        filemode = true
 +
        bare = false
 +
        logallrefupdates = true
 +
[remote "origin"]
 +
        fetch = +refs/heads/*:refs/remotes/origin/*
 +
        url = https://dtenev@git.eclipse.org/gitroot/webtools/incubator/org.eclipse.webtools.incubator.sieditor.git
 +
[branch "master"]
 +
        remote = origin
 +
        merge = refs/heads/master
 +
[http]
 +
proxy = http://proxy:8080
 +
[user]
 +
name = dtenev
 +
email = dimitar.tenev@some.com
 +
</pre>
 +
It is configured for the following git project (notice that you got the 'c' letter into the following path): [https://git.eclipse.org/c/webtools/incubator/org.eclipse.webtools.incubator.sieditor.git/ https://git.eclipse.org/c/webtools/incubator/org.eclipse.webtools.incubator.sieditor.git/] <br>
  
=== Setting up ssh keys ===
+
Do notice few things:<br>
['''This doesn't work unless you are a project lead or are granted a proper shell to work in (only project leads at the moment). See [https://bugs.eclipse.org/bugs/show_bug.cgi?id=312034 bug 312034].''']
+
  
To avoid having to type in your password for each interaction with the server when using git from the command line:
+
*URL to the remote contains user's name. Git will require your password on '''git push''' execution. <br>
* Generate a public/private key pair if you don't already have one on your own machine
+
*URL to the remote does not contain the 'c' letter from the https browse URL above.<br><br>
* sftp committer_id@git.eclipse.org and transfer the id_xxx.pub files from your .ssh directory
+
* ssh committer_id@git.eclipse.org
+
* mkdir .ssh
+
* chmod 755 .ssh
+
* cd .ssh
+
* cat ../id_xxx.pub >>authorized_keys (for each .pub file you transferred)
+
* chmod 755 authorized_keys
+
  
['''At the moment, sftp is blocked, and using scp works, but you cannot run the mkdir command so cannot put the *.pub files into authorized_keys.''']
+
<br>

Revision as of 07:08, 11 November 2010

This page is a work in progress, and is not yet complete. Not every project has a Git repository -- just like not every project has an SVN or CVS repository.


Contents

Git mirrors of CVS repositories

The CVS repositories at Eclipse.org are being mirrored to read-only Git repositories. Please see the git repositories page for the full list of repositories. Please note that Git mirrors will be deleted for those projects that migrate to Git.

Git repositories

Eclipse projects may use either CVS, SVN or Git. The project you are looking for may not be using Git. Please see CVS Howto and SVN Howto for more information. If you are unsure which type of repository a project is using, please go to that project's home page.

My Eclipse project wants to use Git

Migrating from CVS/SVN to Git

Please see Git/Migrating to Git.

Committers new to Git

Before working on a Git repository, please:

  • Read Git for Dummies
  • Have the Git Guide handy
  • Note that anyone can commit to their repo, but only Eclipse committers can push their repo to git.eclipse.org
  • DON'T FORGET to configure your git environment
   git config --global user.email my_committer_email@address.com
   git config --global user.name "John Doe"
  • Note that the above will set this as the default user name and email address to use when writing commits. You can set user.name and password on a per repository basis.
   git config user.email my_committer_email@address.com
   git config user.name "John Doe"

This will set the username and email address on just the current git repository.

List of Git repositories available

Please connect to http://git.eclipse.org/

Connecting, cloning a repo

Please see the list of Git repositories (above).

Committer access:

   git clone ssh://committer_id@git.eclipse.org/gitroot/project/repo
   git clone https://committer_id@git.eclipse.org/gitroot/project/repo (if enabled for your repository)

Committer access via https is disabled (and discouraged), but it is available. Please ask Webmaster if you absolutely need commit access over https.


Anonymous, read-only access:

   git clone git://git.eclipse.org/gitroot/project/repo
   git clone http://git.eclipse.org/gitroot/project/repo

Examples:

   git clone ssh://droy@git.eclipse.org/gitroot/babel/org.eclipse.babel.server.git
   git clone git://git.eclipse.org/gitroot/babel/org.eclipse.babel.server.git

Committing and pushing

The wrong way
The right way
Before committing code to your cloned repo, please ensure that your Git environment is properly set. Otherwise, the email address stored in the commit transaction in your repository will not match the email address of your Eclipse Committer record with the Eclipse Foundation, and your push will fail.

Notes on DVCS

Due to our rigorous IP process, the Eclipse.org use-case for a DVCS is different than that of other Open Source organizations. For this reason, an update hook is installed and must remain in place on every Git repository to ensure a clean IP provenance.

The Eclipse update hook will examine the Committer entries of an incoming push. All the committer entries must be made by the committer performing the push, or the push will fail. Furthermore, your committer ID, or the committer email address registered with your committer account at the Eclipse Foundation must be present in the Committer Email record. Here are some scenarios to help understand this restriction:

   Scenario 1
   Jane Contributor is Author of code.  Commits to her local repo.
   Jane Contributer pushes (publishes) to a committer's local repo.
   Committer pushes code to git.eclipse.org will fail.  
     Committer cannot push code to us that they did not Commit.
   Scenario 2
   Jane Committer is Author of code. Commits to her local repo.
   Jane Committer pushes (publishes) to another committer's local repo.
   Committer pushes code to git.eclipse.org will fail.  
     Committer cannot push code to us that they did not commit (even if it is 
     from another committer).
   Scenario 3
   Jane Committer, known as jane@bigcorp.com to the Eclipse Foundation, is Author of code. Commits to her local repo as jane@someisp.com.
   Jane Committer pushes code to git.eclipse.org will fail.  
     Eclipse.org does not recognize jane@someisp.com.
   Scenario 4
   Joe Contributor Authors code. Commits to his local repo.
   Joe Contributor attaches patch to Bugzilla.
   Committer applies patch to his local repo, commits to his local repo.
   Committer pushes code to git.eclipse.org will succeed.   
     Committer can push their committed code to us, preserving the Author information in the transaction.

Creating a new repository

Webmaster can create a new repository for you. Just open a bug against Eclipse Foundation > Community > Git. However, Eclipse committers with shell accounts can create new repositories:

   initrepo /gitroot/project/org.eclipse.repo.name.git

For consistency, the name of the repository must end with .git.

Permanently deleting code from Git

If you are required to permanently remove code from a Git repository, please open a bug against Community/Git and Webmaster will do this for you.

Setting up ssh keys

[This doesn't work unless you are a project lead or are granted a proper shell to work in (only project leads at the moment). See bug 312034.]

To avoid having to type in your password for each interaction with the server when using git from the command line:

  • Generate a public/private key pair if you don't already have one on your own machine
  • sftp committer_id@git.eclipse.org and transfer the id_xxx.pub files from your .ssh directory
  • ssh committer_id@git.eclipse.org
  • mkdir .ssh
  • chmod 755 .ssh
  • cd .ssh
  • cat ../id_xxx.pub >>authorized_keys (for each .pub file you transferred)
  • chmod 755 authorized_keys

[At the moment, sftp is blocked, and using scp works, but you cannot run the mkdir command so cannot put the *.pub files into authorized_keys.]

Setting up https for pushing

Here is a sample .gitconfig file which is used for git push via https. It is expected to be into your user's system directory (e.g. for Windows Vista "C:\Users\dtenev\.gitconfig").

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = https://dtenev@git.eclipse.org/gitroot/webtools/incubator/org.eclipse.webtools.incubator.sieditor.git
[branch "master"]
        remote = origin
        merge = refs/heads/master
[http]
	proxy = http://proxy:8080
[user]
	name = dtenev
	email = dimitar.tenev@some.com

It is configured for the following git project (notice that you got the 'c' letter into the following path): https://git.eclipse.org/c/webtools/incubator/org.eclipse.webtools.incubator.sieditor.git/

Do notice few things:

  • URL to the remote contains user's name. Git will require your password on git push execution.
  • URL to the remote does not contain the 'c' letter from the https browse URL above.