README.md 4.3 KB
Newer Older
M
Mislav Marohnić 已提交
1 2
hub is a command line tool that wraps `git` in order to extend it with extra
features and commands that make working with GitHub easier.
C
readme  
Chris Wanstrath 已提交
3

M
Mislav Marohnić 已提交
4 5 6 7 8 9 10
This repository and its issue tracker is **not for reporting problems with
GitHub.com** web interface. If you have a problem with GitHub itself, please
[contact Support](https://github.com/contact).

Usage
-----

11
``` sh
M
Mislav Marohnić 已提交
12
$ hub clone rtomayko/tilt
C
readme  
Chris Wanstrath 已提交
13

M
Mislav Marohnić 已提交
14 15
# expands to:
$ git clone git://github.com/rtomayko/tilt.git
16
```
C
Chris Wanstrath 已提交
17

M
Mislav Marohnić 已提交
18 19
hub can be safely [aliased](#aliasing) as `git` so you can type `$ git
<command>` in the shell and get all the usual `hub` features.
C
tweak  
Chris Wanstrath 已提交
20

21 22
See [Usage documentation](https://hub.github.com/hub.1.html) for the list of all
commands and their arguments.
C
Chris Wanstrath 已提交
23

M
Mislav Marohnić 已提交
24 25 26
Hub can also be used to make shell scripts that [manually interface with the
GitHub API](https://hub.github.com/hub-api.1.html).

M
Mislav Marohnić 已提交
27 28
Installation
------------
C
Chris Wanstrath 已提交
29

M
Mislav Marohnić 已提交
30 31
The `hub` executable has no dependencies, but since it was designed to wrap
`git`, it's recommended to have at least **git 1.7.3** or newer.
C
tweak  
Chris Wanstrath 已提交
32

33 34
#### Homebrew

35
`hub` can be installed through [Homebrew](https://docs.brew.sh/Installation) on macOS or Linux:
36

37
``` sh
38 39 40
$ brew install hub
$ hub version
git version 1.7.6
41 42 43
hub version 2.2.3
```

M
Mislav Marohnić 已提交
44
#### Windows
45

46
`hub` can be installed through [Scoop](http://scoop.sh/) on Windows:
47 48

``` sh
49
> scoop install hub
50
```
51

52 53 54 55 56 57
or alternatively `hub` can be installed through [Chocolatey](https://chocolatey.org/):

``` sh
> choco install hub
```

58 59 60 61 62 63 64 65 66 67 68
#### Fedora Linux

On Fedora you can install `hub` through DNF:

``` sh
$ sudo dnf install hub
$ hub version
git version 2.9.3
hub version 2.2.9
```

69 70
#### Arch Linux

K
FIXUP  
Kim Hansen 已提交
71
On Arch Linux you can install `hub` from the official repository:
72 73

```sh
M
Mislav Marohnić 已提交
74
$ sudo pacman -S hub
75 76
```

77 78 79 80 81 82 83 84 85
#### FreeBSD

On FreeBSD you can install a prebuilt `hub` package with
[pkg(8)](http://man.freebsd.org/pkg/8):

```console
# pkg install hub
```

86 87
#### Debian

K
FIXUP  
Kim Hansen 已提交
88
On Debian (versions sid and buster) you can install `hub` from the official repository:
89 90

```sh
K
FIXUP  
Kim Hansen 已提交
91
$ sudo apt install hub
92 93
```

94 95 96 97 98 99 100 101 102
#### Ubuntu Linux

On Ubuntu you can install `hub` through [Snap](https://github.com/snapcore/snapcraft) :

```sh
$ snap install hub --classic
```

## Standalone
O
Owen Ou 已提交
103

104
`hub` can be easily installed as an executable. Download the latest
105 106
[compiled binaries](https://github.com/github/hub/releases) and put it anywhere
in your executable path.
O
Owen Ou 已提交
107 108 109

#### Source

110
With your [GOPATH](https://github.com/golang/go/wiki/GOPATH) already set up:
O
Owen Ou 已提交
111

112 113 114 115 116 117 118 119 120
```sh
mkdir -p "$GOPATH"/src/github.com/github
git clone \
  --config transfer.fsckobjects=false \
  --config receive.fsckobjects=false \
  --config fetch.fsckobjects=false \
  https://github.com/github/hub.git "$GOPATH"/src/github.com/github/hub
cd "$GOPATH"/src/github.com/github/hub
make install prefix=/usr/local
M
Mislav Marohnić 已提交
121
```
O
Owen Ou 已提交
122

M
Marcio Puga 已提交
123
Prerequisites for compilation are:
M
Mislav Marohnić 已提交
124

M
Mislav Marohnić 已提交
125
* `make`
M
Mislav Marohnić 已提交
126
* [Go 1.9+](http://golang.org/doc/install)
M
Mislav Marohnić 已提交
127

C
Chris Wanstrath 已提交
128 129
Aliasing
--------
C
readme  
Chris Wanstrath 已提交
130

M
Mislav Marohnić 已提交
131
Some hub features feel best when it's aliased as `git`. This is not dangerous; your
M
Mislav Marohnić 已提交
132
_normal git commands will all work_. hub merely adds some sugar.
C
readme  
Chris Wanstrath 已提交
133

134 135
`hub alias` displays instructions for the current shell. With the `-s` flag, it
outputs a script suitable for `eval`.
C
Chris Wanstrath 已提交
136

137
You should place this command in your `.bash_profile` or other startup script:
C
Chris Wanstrath 已提交
138

139
``` sh
140
eval "$(hub alias -s)"
141
```
C
tweaks  
Chris Wanstrath 已提交
142

143 144
#### PowerShell

P
Pepper Lebeck-Jobe 已提交
145 146
If you're using PowerShell, you can set an alias for `hub` by placing the
following in your PowerShell profile (usually
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
`~/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1`):

``` sh
Set-Alias git hub
```

A simple way to do this is to run the following from the PowerShell prompt:

``` sh
Add-Content $PROFILE "`nSet-Alias git hub"
```

Note: You'll need to restart your PowerShell console in order for the changes to be picked up.

If your PowerShell profile doesn't exist, you can create it by running the following:

``` sh
New-Item -Type file -Force $PROFILE
```

167 168
### Shell tab-completion

169 170
hub repository contains tab-completion scripts for bash, zsh and fish.
These scripts complement existing completion scripts that ship with git.
171

172 173
[Installation instructions](etc)

M
Mislav Marohnić 已提交
174 175
* [hub bash completion](https://github.com/github/hub/blob/master/etc/hub.bash_completion.sh)
* [hub zsh completion](https://github.com/github/hub/blob/master/etc/hub.zsh_completion)
M
Michihito Shigemura 已提交
176
* [hub fish completion](https://github.com/github/hub/blob/master/etc/hub.fish_completion)
177

C
Chris Wanstrath 已提交
178 179
Meta
----
C
readme  
Chris Wanstrath 已提交
180

M
Mislav Marohnić 已提交
181 182 183
* Home: <https://github.com/github/hub>
* Bugs: <https://github.com/github/hub/issues>
* Authors: <https://github.com/github/hub/contributors>