Infrastructure/Git: Difference between revisions

From KDE Community Wiki
m (→‎Anonymous access: hub link example)
(7 intermediate revisions by 5 users not shown)
Line 14: Line 14:
Both Git and Subversion repositories can be accessed anonymously by anyone. This access takes place from <code>anongit.kde.org</code> and <code>anonsvn.kde.org</code> for Git and Subversion respectively, and grants read only access to the same repositories which are available to contributors with developer accounts.
Both Git and Subversion repositories can be accessed anonymously by anyone. This access takes place from <code>anongit.kde.org</code> and <code>anonsvn.kde.org</code> for Git and Subversion respectively, and grants read only access to the same repositories which are available to contributors with developer accounts.


For Git, it is possible to perform clones and fetches over either the Git or HTTP protocols, depending on your situation. Access over HTTP is usually necessary when you are behind a restrictive network firewall. If your network access is unreliable, then you may want to download an archive of the repository instead, which you can freely resume the download of, as well as commit to and update later by using the usual git commands. These archives can be accessed at <code>https://anongit.kde.org/&lt;repository&gt;/&lt;repository&gt;-latest.tar.gz</code>.
For Git, it is possible to perform clones and fetches over the HTTPS protocol only.


KDE also maintains a mirror of its mainline Git repositories on [https://github.com/kde/ GitHub]. This mirror is read-only, and disables all of GitHub's additional features, such as issues, the wiki, and downloads, in favour of KDE's own hosted services. Additionally, pull requests on these repositories are not accepted, but code changes can always be accepted through KDE's code-review services. And still, GitHub may be used / searched more intuitively than alternatives, e.g. when a particular [https://github.com/KDE/extra-cmake-modules/releases ECM] version is needed, as it will.  
KDE also maintains a mirror of its mainline Git repositories on [https://github.com/kde/ GitHub]. This mirror is read-only, and disables all of GitHub's additional features, such as issues, the wiki, and downloads, in favour of KDE's own hosted services. Additionally, pull requests on these repositories are not accepted, but code changes can always be accepted through KDE's code-review services. And still, GitHub may be used / searched more intuitively than alternatives, e.g. when a particular [https://github.com/KDE/extra-cmake-modules/releases ECM] version is needed, as it will.  
Line 24: Line 24:
Push or commit access to all KDE code repositories is open to any holder of a KDE developer account, subject to few limitations. This model allows contributors to easily make contributions to all parts of KDE without needing further approval. All commits made to either Git or Subversion are subject to commit hooks which will perform a few quality control checks and can take other actions on behalf of the developer. In the case of both Git and Subversion it is only possible to commit over SSH.
Push or commit access to all KDE code repositories is open to any holder of a KDE developer account, subject to few limitations. This model allows contributors to easily make contributions to all parts of KDE without needing further approval. All commits made to either Git or Subversion are subject to commit hooks which will perform a few quality control checks and can take other actions on behalf of the developer. In the case of both Git and Subversion it is only possible to commit over SSH.


With KDE Git, it is recommended to use a shortcut to access repositories instead of directly cloning them from the Git server itself. This shortcut allows you to use a local mirror of the repositories, and should improve response times. To setup a <code>kde:</code> shortcut, you should add the following configuration block to <code>~/.gitconfig</code>. If your network blocks the Git protocol, then you can exchange that for HTTP instead.
With KDE Git, it is recommended to use a shortcut to access repositories instead of directly cloning them from the Git server itself. This shortcut allows you to use a local mirror of the repositories, and should improve response times. To setup a <code>kde:</code> shortcut, you should add the following configuration block to <code>~/.config/git/config</code>. If your network blocks the Git protocol, then you can exchange that for HTTP instead.


<pre>[url &quot;git://anongit.kde.org/&quot;]
<pre>[url &quot;https://git@invent.kde.org/&quot;]
     insteadOf = kde:
     insteadOf = kde:
[url &quot;git@git.kde.org:&quot;]
[url &quot;ssh://git@invent.kde.org/&quot;]
     pushInsteadOf = kde:</pre>
     pushInsteadOf = kde:</pre>
Once setup as above, you can clone and push to repositories through the URL <code>kde:repository</code>.
Once setup as above, you can clone and push to repositories through the shortcut <code>kde:''repository''</code>, for example <code>kde:office/skrooge.git</code>.


As Subversion requires that checkouts you are committing from are made from the same location you are committing to, checkouts should be made from the Subversion server directly. It can be accessed at <code>svn+ssh://[email protected]/home/kde/</code>. If you have existing checkouts, you will need to relocate them using the <code>svn switch</code> command before you are able to commit.
As Subversion requires that checkouts you are committing from are made from the same location you are committing to, checkouts should be made from the Subversion server directly. It can be accessed at <code>svn+ssh://[email protected]/home/kde/</code>. If you have existing checkouts, you will need to relocate them using the <code>svn switch</code> command before you are able to commit.
Line 46: Line 46:
To allow for free form development in a manner similar to Subversion did, KDE Git allows personal repositories to be created on demand as needed. Two types of personal repository are available:
To allow for free form development in a manner similar to Subversion did, KDE Git allows personal repositories to be created on demand as needed. Two types of personal repository are available:


Scratch repositories are created on the fly when a developer pushes to them for the first time, and exist at <code>scratch/username/myRepo</code>. These are recommended for new development work.
Scratch repositories can be created by the GitLab web UI by using the "New project" button in the Projects area. Such repositories are recommended for new development work.


Clone repositories are created by cloning an existing project repository, and exist at <code>clones/project/username/myClone</code>. They are created by running <code>ssh [email protected] clone project myClone</code> where <code>myClone</code> is the name you wish to call your clone, and <code>project</code> is the name of the repository you are cloning.
Clone repositories are created by cloning an existing project repository, and exist at <code>clones/project/username/myClone</code>. They are created by running <code>ssh [email protected] clone project myClone</code> where <code>myClone</code> is the name you wish to call your clone, and <code>project</code> is the name of the repository you are cloning.
Line 68: Line 68:
The SSH host server key fingerprints are as follows for both Git and Subversion access:
The SSH host server key fingerprints are as follows for both Git and Subversion access:


* '''RSA-2048 (MD5)''': <code>f9:54:62:b2:90:f2:dc:08:df:f4:a3:fa:c5:2a:a0:c8</code>
* '''RSA-2048 (MD5)''': <code>32:c9:78:b1:1f:7c:2e:1c:12:26:62:1c:67:d0:6c:28</code>
* '''RSA-2048 (SHA256)''': <code>eONstlOUy0LjhlkjK90e1/bm95fOqnz8qcUsijWuP0Q</code>
* '''RSA-2048 (SHA256)''': <code>rgF+nO+jdBEKOdowaOZBnaeWtAV6vquW4EjFafO1aaM</code>
* '''ECDSA-256 (MD5)''': <code>23:62:3e:0b:18:f2:5d:e9:66:8a:80:fb:82:53:84:b5</code>
* '''ECDSA-256 (MD5)''': <code>cb:56:a3:74:a8:69:5c:f3:93:b0:dc:f9:05:1c:3f:9a</code>
* '''ECDSA-256 (SHA256)''': <code>Bvp9zqBBiEf9QdpX09B0PL2CkDa1B64WtkKZyTq7XhM</code>
* '''ECDSA-256 (SHA256)''': <code>UutSIkXdSGgyxQxL35dDEEAD2Owel+zEdKZ5I/JMqrA</code>
* '''ED25519-256 (MD5)''': <code>f3:17:e5:0b:79:16:2b:73:45:fa:5d:23:24:eb:33:40</code>
* '''ED25519-256 (MD5)''': <code>c8:99:54:39:84:9b:e5:39:1a:de:c6:6d:fa:4d:a4:e8</code>
* '''ED25519-256 (SHA256)''': <code>x8pnmJ/gZmuw68V+wJUlT3MreIzPACzKmd/Ybei9gBA</code>
* '''ED25519-256 (SHA256)''': <code>tPgR57xn3BJVri4ncIMAtj/3Dxc9SB/ijOxORUTCQFk</code>


== Resources == <!--T:21-->
== Resources == <!--T:21-->

Revision as of 17:15, 24 March 2021

<languages /> <translate> This is the hub page for all information about the use of Git by KDE.

This section provides details on using the KDE Git infrastructure. This is intended for use by KDE developers to find out how KDE uses Git and how to set up Git for use with KDE.


Git at KDE

KDE currently offers code hosting using Git. Additionally, KDE also maintains a limited Subversion infrastructure for certain special projects, such as translations and older websites.

Anonymous access

Both Git and Subversion repositories can be accessed anonymously by anyone. This access takes place from anongit.kde.org and anonsvn.kde.org for Git and Subversion respectively, and grants read only access to the same repositories which are available to contributors with developer accounts.

For Git, it is possible to perform clones and fetches over the HTTPS protocol only.

KDE also maintains a mirror of its mainline Git repositories on GitHub. This mirror is read-only, and disables all of GitHub's additional features, such as issues, the wiki, and downloads, in favour of KDE's own hosted services. Additionally, pull requests on these repositories are not accepted, but code changes can always be accepted through KDE's code-review services. And still, GitHub may be used / searched more intuitively than alternatives, e.g. when a particular ECM version is needed, as it will.

For Subversion, access is only provided over the Subversion protocol. If you are behind a restrictive firewall and need to access the KDE Subversion repository anonymously (and have no other means of network access), please file a ticket.

Pushing

Push or commit access to all KDE code repositories is open to any holder of a KDE developer account, subject to few limitations. This model allows contributors to easily make contributions to all parts of KDE without needing further approval. All commits made to either Git or Subversion are subject to commit hooks which will perform a few quality control checks and can take other actions on behalf of the developer. In the case of both Git and Subversion it is only possible to commit over SSH.

With KDE Git, it is recommended to use a shortcut to access repositories instead of directly cloning them from the Git server itself. This shortcut allows you to use a local mirror of the repositories, and should improve response times. To setup a kde: shortcut, you should add the following configuration block to ~/.config/git/config. If your network blocks the Git protocol, then you can exchange that for HTTP instead.

[url "https://[email protected]/"]
    insteadOf = kde:
[url "ssh://[email protected]/"]
    pushInsteadOf = kde:

Once setup as above, you can clone and push to repositories through the shortcut kde:repository, for example kde:office/skrooge.git.

As Subversion requires that checkouts you are committing from are made from the same location you are committing to, checkouts should be made from the Subversion server directly. It can be accessed at svn+ssh://[email protected]/home/kde/. If you have existing checkouts, you will need to relocate them using the svn switch command before you are able to commit.

Browsing

To allow for quick review of code, web repository browsers exist for both Git and Subversion repositories. Those interested in browsing Subversion should visit WebSVN, which will contain the latest commits made to the KDE Subversion repository subject to a delay of 10 minutes at maximum.

In the case of Git, repository browsing is available via cgit. Additionally, all mainline repositories are available on GitHub and can be browsed there. Please note that scratch and clone repositories are only browsable on cgit.

If you need to link to materials which are stored in either Git or Subversion repositories on KDE infrastructure, it is requested that you do not embed the content directly, but simply link to it. Embedding content causes significantly higher load on the repository browser servers, making it unavailable for others wishing to use it. This is particularly relevant for blog posts on Planet or any other high traffic web page.

New repositories

To allow for free form development in a manner similar to Subversion did, KDE Git allows personal repositories to be created on demand as needed. Two types of personal repository are available:

Scratch repositories can be created by the GitLab web UI by using the "New project" button in the Projects area. Such repositories are recommended for new development work.

Clone repositories are created by cloning an existing project repository, and exist at clones/project/username/myClone. They are created by running ssh [email protected] clone project myClone where myClone is the name you wish to call your clone, and project is the name of the repository you are cloning.

Personal repositories can be deleted at any time.

From time to time it may be necessary to create new project repositories, to contain newly developed applications, migrate existing applications from Subversion or to bring new projects under the KDE umbrella. New repositories can be requested by filing a ticket, and will usually be created at the top level on git.kde.org.

Extra Karma

At times contributors may find it necessary to push or commit to certain repositories or paths which are protected. In this case the server will reject your request with a message such as insufficient karma or access denied. This protection is most often applied to repositories which run parts of the infrastructure such as websites or other crucial components.

If you would like to request access to these protected areas, please file a ticket, mentioning which repositories or paths you are trying to change.

A complete manual on how to use KDE's Git services, along with some best practices, is available on the KDE Community Wiki.

Hooks

Kde provides some git hooks to perform and automatize some actions on push.

Server Fingerprints

The SSH host server key fingerprints are as follows for both Git and Subversion access:

  • RSA-2048 (MD5): 32:c9:78:b1:1f:7c:2e:1c:12:26:62:1c:67:d0:6c:28
  • RSA-2048 (SHA256): rgF+nO+jdBEKOdowaOZBnaeWtAV6vquW4EjFafO1aaM
  • ECDSA-256 (MD5): cb:56:a3:74:a8:69:5c:f3:93:b0:dc:f9:05:1c:3f:9a
  • ECDSA-256 (SHA256): UutSIkXdSGgyxQxL35dDEEAD2Owel+zEdKZ5I/JMqrA
  • ED25519-256 (MD5): c8:99:54:39:84:9b:e5:39:1a:de:c6:6d:fa:4d:a4:e8
  • ED25519-256 (SHA256): tPgR57xn3BJVri4ncIMAtj/3Dxc9SB/ijOxORUTCQFk

Resources

Links to useful external sites about Git

Official Documentation

Git for SVN Users

Git books

  • Pro Git - An easy to understand book on git (CC licensed).

Tutorials

  • Git Magic - A good intro to git (in several languages!)

- Essential reading if you want to truly understand git.

  • tryGit A 15 minute online interactive tutorial

KDE's Git Infrastructure

The KDE Git System Administrators Manual is a useful resource for more details on the technical implementation of the KDE Git infrastructure.

For more information on how the KDE Git Repositories are organized, please see the Build from source page.

Other:

  • The new Commit Policy is being reviewed, applied to both SVN and Git.
  • GitHub Mirror has been created and policy is in development (Sep 2015).

KDE Git Recipes

Short recipes for using Git with the KDE infrastructure.

Please see the Git Recipes page.

KDE Git Tutorials

More in-depth instructions in using Git.

Please help filling this section by

  • checking the links at the bottom of the page and see which still have valid content
  • write tutorials yourself

Cheat Sheets

(broken image, get it from Media:Zrusin-git-cheat-sheet-medium.png) </translate>