Skip to content

r7kamura/ghq

 
 

Repository files navigation

ghq(1) wercker status

NAME

ghq - Manage remote repository clones

DESCRIPTION

'ghq' provides a way to organize remote repository clones, like go get does. When you clone a remote repository by ghq get, ghq makes a directory under a specific root directory (by default ~/.ghq) using the remote repository URL’s host and path.

$ ghq get https://github.com/motemen/ghq
# Runs `git clone https://github.com/motemen/ghq ~/.ghq/github.com/motemen/ghq`

You can also list local repositories (ghq list), jump into local repositories (ghq look), and bulk cloning repositories from several web services (ghq import).

SYNOPSIS

'ghq' get [-u] [-p] (<repository URL> | <user>/<project> | <project>)
'ghq' list [-p] [-e] [<query>]
'ghq' look (<project> | <path/to/project>)
'ghq' import starred [-u] [-p] <user>
'ghq' import pocket [-u]

COMMANDS

get

Clone a remote repository under ghq root directory (see DIRECTORY STRUCTURES below). If the repository is already cloned to local, nothing will happen unless '-u' ('--update') flag is supplied, in which case the local repository is updated ('git pull --ff-only' eg.). When you use '-p' option, the repository is cloned via SSH protocol.
If there are multiple ghq.root s, existing local clones are searched first. Then a new repository clone is created under the primary root if none is found.
With '-shallow' option, a "shallow clone" will be performed (for Git repositories only, 'git clone --depth 1 …​' eg.). Be careful that a shallow-cloned repository cannot be pushed to remote.
Currently Git and Mercurial repositories are supported.

list

List locally cloned repositories. If a query argument is given, only repositories whose names contain that query text are listed. '-e' ('--exact') forces the match to be an exact one (i.e. the query equals to project or user/project) If '-p' ('--full-path') is given, the full paths to the repository root are printed instead of relative ones.

look

Look into a locally cloned repository with the shell.

import starred

Retrieves GitHub repositories that are starred by the user specified and performs 'get' for each of them. You can set GitHub access token to enviroment variable 'GHQ_GITHUB_TOKEN' or 'ghq.github.taken' in 'git-config' variables. (The former takes precedence over the latter.)

import pocket

Retrieves Pocket entries of github.com and performs 'get' for each of them.
To use this, needs to be compiled with Pocket consumer key. See INSTALLING.

CONFIGURATION

Configuration uses 'git-config' variables.

ghq.root

The path to directory under which cloned repositories are placed. See DIRECTORY STRUCTURES below. Defaults to ~/.ghq.
This variable can have multiple values. If so, the first one becomes primary one i.e. new repository clones are always created under it. You may want to specify "$GOPATH/src" as a secondary root (environment variables should be expanded.)

ghq.<url>.vcs

ghq tries to detect the remote repository’s VCS backend for non-"github.com" repositories. With this option you can explicitly specify the VCS for the remote repository. The URL is matched against '<url>' using 'git config --get-urlmatch'.
Accepted values are "git", "github" (an alias for "git"), "mercurial", "hg" (an alias for "mercurial").
To get this configuration variable effective, you will need Git 1.8.5 or higher.
For example in .gitconfig:

[ghq "https://git.example.com/repos/"]
vcs = git
ghq.ghe.host

The hostname of your GitHub Enterprise installation. A repository that has a hostname set with this key will be regarded as same one as one on GitHub. This variable can have multiple values. If so, ghq tries matching with each hostnames.
This option is DEPRECATED, so use "ghq.<url>.vcs" configuration instead.

ghq.github.token

GitHub’s access token used in ghq import starred command.

DIRECTORY STRUCTURES

Local repositories are placed under 'ghq.root' with named github.com/user/repo.

~/.ghq
|-- code.google.com/
|   `-- p/
|       `-- vim/
`-- github.com/
    |-- codegangsta/
    |   `-- cli/
    |-- google/
    |   `-- go-github/
    `-- motemen/
        `-- ghq/

INSTALLATION

go get github.com/motemen/ghq

Or clone the repository and run:

make install

If you want to enable Pocket importing feature:

go get -ldflags "-X github.com/motemen/ghq/pocket.ConsumerKey <your Pocket consumer key>" github.com/motemen/ghq

Or using Makefile:

make install POCKET_CONSUMER_KEY=<your Pocket consumer key>

AUTHOR

motemen <motemen@gmail.com>

About

Manage remote repository clones (Git or Mercurial)

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published