Diff for "Code/Git"

Not logged in - Log In / Register

Differences between revisions 1 and 2
Revision 1 as of 2015-03-31 11:12:28
Size: 6072
Editor: cjwatson
Comment: first draft
Revision 2 as of 2015-04-28 16:58:49
Size: 5853
Editor: cjwatson
Comment: remove notes about some bugs that are now fixed
Deletions are marked like this. Additions are marked like this.
Line 34: Line 34:
 * pushing forks of new repositories requires pushing all the data again
 * pushing a new default repository for a target (project or distribution source package) does not also set the owner's default for that target

Launchpad Help > Code > Git

Overview

Launchpad features experimental support for hosting Git repositories. This is distinct from the code import facility that Launchpad has included for many years; it will shortly be possible to host Git repositories on Launchpad directly.

Git repositories use a somewhat different model from Bazaar branches: operations such as cloning happen at the level of a repository, but it is common for a single repository to contain many branches. This means that the Launchpad interface needs to be laid out somewhat differently to support that.

What's supported?

As of the end of March 2015, the bare bones of Git hosting support are live on our "qastaging" site. This means:

  • all changes made will be reset - this is not yet a persistent hosting service, but is strictly for experimenting and finding bugs in Launchpad
  • the URL format is not guaranteed to be stable
  • everything is on qastaging.launchpad.net and git.qastaging.paddev.net, rather than on the main launchpad.net site
  • the hosting backend is still quite basic and may have scaling problems

Within these constraints, you can:

  • push Git repositories to qastaging over SSH
  • clone repositories over git://, SSH, or HTTPS
  • see summary information on repositories in the Launchpad web UI on qastaging
  • follow links from the Launchpad web UI to a full-featured code browser

Just don't keep the only copy of your repository on qastaging!

What will be supported?

Our top priority is to polish things up so that this can land on Launchpad production, and to this end we appreciate your feedback on any bugs you find. Here's a short list of known bugs that you don't need to tell us about:

  • finding the URL for a new repository after you've pushed it is hard

Launchpad's Bazaar support has grown many features over the years, and it will take some time to bring our Git support up to full parity with it. Here's an incomplete list of some of the features we expect to add:

  • merge proposals (these are very heavily used by many teams, including Launchpad itself, so are the top feature priority)
  • subscriptions
  • RSS feeds
  • mirroring
  • webhooks
  • an integrated code browser

Configuring Git

Git identifies repositories using URLs. Unlike Bazaar, there is no built-in abbreviation for repositories hosted on Launchpad, but it is very easy to add such a thing yourself. Edit ~/.gitconfig and add these lines, where USER is your Launchpad username:

[url "git+ssh://USER@git.qastaging.paddev.net/"]
        insteadof = lpqas:

This allows you to type git clone lpqas:REPOSITORY instead of git clone git+ssh://git.qastaging.paddev.net/REPOSITORY. (Of course, when we add Git support to production we will update this documentation to recommend lp: instead.)

The rest of this documentation assumes that you have configured Git this way.

Getting code

You can fetch the default repository for a project like this:

$ git clone lpqas:PROJECT

For example, git clone lpqas:launchpad fetches Launchpad itself.

To keep your local clone up to date, run:

$ git pull

Pushing code

You can add a "remote" to your repository like this, if you own the project:

$ git remote add lpqas lpqas:PROJECT

Or like this (where USER is your Launchpad username), if you do not own the project:

$ git remote add lpqas lpqas:~USER/PROJECT

Now, you can push a branch using a command such as this:

$ git push lpqas my-changes

Repository URLs

Every Git repository hosted on Launchpad has a full "canonical" URL of one of these forms (these are the versions you'd use in a web browser; you only need to change the scheme and host parts for the command-line Git client):

These are unique, but can involve quite a lot of typing, and in most cases there's no need for more than one repository per owner and target (project or package). Launchpad therefore has the notion of "default repositories". A repository can be the default for a target, in which case it has one of these forms:

Or a repository can be a person's or a team's default for a target, in which case it has one of these forms:

We expect that projects hosting their code on Launchpad will normally have their primary repository set as the default for the project, and contributors will normally push to branches in owner-default repositories. The extra flexibility with named repositories allows for situations such as separate private repositories containing embargoed security fixes.

Code/Git (last edited 2023-10-19 13:59:58 by jugmac00)