I've been contemplating a URI scheme for referencing objects in Git repositories.

Requirements

I would want this scheme to be able to:

It would be nice if it could also:

Proposal

x-git-object-encoded:asdf1234
References the object file with hash 'asdf1234', including the header.
x-git-object:asdf1234
References the object encoded by the file with hash 'asdf1234'. If the object is a blob, this URN would resolve to the blob itself (a sequence of bytes). If the referenced object is not a blob, then it is not directly representable as a byte stream, and a strict resolver would return an error if it is asked to represent it as a byte stream.
x-git-object:asdf1234?repository=http://github.com/TOGoS/PHPN2R.git
References the object identified by 'asdf1234' and provides a repository from which to fetch it. More than one 'repository' parameter could be specified.
x-git-object:asdf1234#path/to/file
Assuming asdf1234 identifies a commit or tree object, #path/to/file would find the object called 'path/to/file' referenced by that commit.
x-git-object:latest?branch=master?repository=http://github.com/TOGoS/PHPN2R.git
References the latest commit on branch 'master' in any of the listed repositories.
x-git-object:latest?branch=master?signedby=urn:bitprint:ABCDEFG
References the latest commit on branch 'master' signed using the specified public key. Not sure what format the public key would be in. Possibly that output by 'gpg --export' (which you could fingerprint using 'gpg --with-fingerprint <file>')
x-git-commit
a clearer alternative scheme to x-git-object when the named object is a commit. Maybe x-git-tree and x-git-blob, too.

Example

x-git-commit:0d187173d04e67fef5e9178ee761786df04905f0?repository=https://github.com/TOGoS/TFMPM.git references this commit and hints to look for it in that GitHub repository.

Notes