clarify personal repositories
|Deletions are marked like this.||Additions are marked like this.|
|Line 13:||Line 13:|
|This summary is up-to-date as of February 2016.||This summary is up-to-date as of March 2016.|
|Line 24:||Line 24:|
|* use [[Packaging/SourceBuilds|recipes]] to build packages in PPAs for code in Launchpad-hosted Git repositories (if you are in [[https://launchpad.net/~launchpad-beta-testers|~launchpad-beta-testers]])||* use [[Packaging/SourceBuilds|recipes]] to build packages in PPAs for code in Launchpad-hosted Git repositories|
|Line 53:||Line 53:|
You should check the [[SSHFingerprints|fingerprint]] of git.launchpad.net when prompted to do so by SSH.
Launchpad supports hosting Git repositories. This is distinct from the code import facility that Launchpad has included for many years; it is now 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.
This summary is up-to-date as of March 2016.
Launchpad supports Git hosting. This means that you can:
- push Git repositories over SSH
- clone repositories over git://, SSH, or HTTPS
- see summary information on repositories and the branches they contain in the Launchpad web UI
- follow links from the Launchpad web UI to a full-featured code browser
- push and clone private repositories, if you have a commercial subscription to Launchpad
- propose merges from one branch to another, including in a different repository, provided that they are against the same project or package
add webhooks to notify third-party services when repositories are changed
use recipes to build packages in PPAs for code in Launchpad-hosted Git repositories
What will be supported?
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:
- useful subscriptions (currently only attribute change notifications work, which are not usually very interesting in themselves)
- RSS feeds
- an integrated code browser
Here's a short list of known bugs that you don't need to tell us about:
- the interface for registering merge proposals is very rough
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.launchpad.net/"] insteadof = lp:
This allows you to type git clone lp:REPOSITORY instead of git clone git+ssh://git.launchpad.net/REPOSITORY.
The rest of this documentation assumes that you have configured Git this way.
For personal repositories, you can also add:
[url "git+ssh://USER@git.launchpad.net/~USER/+git/"] insteadof = lpme:
You should check the fingerprint of git.launchpad.net when prompted to do so by SSH.
You can fetch the default repository for a project like this:
$ git clone lp:PROJECT
For example, git clone lp:launchpad fetches Launchpad itself (or will once we've finished converting it to Git!).
To keep your local clone up to date, run:
$ git pull
You can add a "remote" to your repository like this, if you own the project:
$ git remote add origin lp:PROJECT
Or like this (where USER is your Launchpad username), if you do not own the project:
$ git remote add origin lp:~USER/PROJECT
Now, you can push a branch using a command such as this:
$ git push origin my-changes
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):
- This identifies a repository for an upstream project.
- This identifies a repository for a source package in a distribution.
- This identifies a "personal" repository with no particular connection to any project or package (like "+junk" in Launchpad's Bazaar code hosting).
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:
- This is the default repository for an upstream project.
- This is the default repository for a source package in a distribution.
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:
- This is an owner's default repository for an upstream project.
- This is an owner's default repository for a source package in a distribution.
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.
Converting from Bazaar to Git
$ cd /some/place # parent directory of Bazaar branch $ mkdir new-git-repo $ cd new-git-repo $ git init . $ bzr fast-export --export-marks=../marks.bzr ../old-bzr-branch | git fast-import --export-marks=../marks.git $ git checkout master
Now the new-git-repo directory is a Git repository with history equivalent to your old Bazaar branch. You should push it somewhere, and to ensure that everything is correct you should re-clone it locally to whatever final destination path you want to work in.
If you have several different Bazaar branches that form part of the same project, or if your Bazaar branches constitute packaging for a project whose upstream is in revision control elsewhere, then you may well want to do a more careful conversion. For this, reposurgeon is an excellent tool: it gives you a language for describing the transformations you want to make to your input branches, so you can run the migration several times with different tweaks before deciding that the result is the one you want to publish to the world.
Once you're ready to use Git by default for your project, you can configure this from https://launchpad.net/PROJECT/+configure-code (which is linked from the "Configuration Progress" section of the main project page on Launchpad).