HowTo: Launchpad’s Git repos

git_logo_compSo far you could import your Git repositories to Canonical’s Launchpad code hosting service a Bazaar branch. But with the growing popularity of Git Launchpad couldn’t shy away from native Git support for long, could it? Yes, Launchpad has introduced Git support as a beta offering. Ubuntu app devs who use services like GitHub can make the most out of it by service their code right out of Launchpad.

Status

The following features are already supported:

  • 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 of the same project or package

Incoming

The long term plan is to support every Bazaar feature for Git as well. Those include:

  • useful subscriptions (currently only attribute change notifications work)
  • RSS feeds
  • mirroring
  • webhooks
  • an integrated code browser

Configuring Git

Edit ~/.gitconfig and add the lines below, where USER is your Launchpad username:

[url "git+ssh://USER@git.launchpad.net/"]
        insteadof = lp:

This allows you to type git clone lp:REPOSITORY.

Using Git with Launchpad

To fetch the default repository for a project, run:

$ git clone lp:PROJECT

For example, git clone lp:launchpad fetches Launchpad itself (or will once te conversion is done).

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 lp lp:PROJECT

If you do not own the project:

$ git remote add lp lp:~USER/PROJECT

To push a branch, run:

$ git push lp my-changes

Repository URLs

Every Git repository hosted on Launchpad has a full “canonical” URL of one of these forms (the URLs are for web browser; you need to change the scheme and host parts for the command-line Git client):

Repository for an upstream project.
https://code.launchpad.net/~OWNER/PROJECT/+git/REPOSITORY

Repository for a source package in a distribution.
https://code.launchpad.net/~OWNER/DISTRIBUTION/+source/SOURCE/+git/REPOSITORY

A “personal” repository with no particular connection to any project or package.
https://code.launchpad.net/~OWNER/+git/REPOSITORY

These are unique, an long. 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:

Default repository for an upstream project.
https://code.launchpad.net/PROJECT

Default repository for a source package in a distribution.
https://code.launchpad.net/DISTRIBUTION/+source/SOURCE

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

Owner’s default repository for an upstream project.
https://code.launchpad.net/~OWNER/PROJECT

Owner’s default repository for a source package in a distribution.
https://code.launchpad.net/~OWNER/DISTRIBUTION/+source/SOURCE

Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s