README.md 3.8 KB
Newer Older
M
Mislav Marohnić 已提交
1 2
git + hub = github
==================
C
readme  
Chris Wanstrath 已提交
3

M
Mislav Marohnić 已提交
4 5
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 已提交
6

7
``` sh
M
Mislav Marohnić 已提交
8
$ hub clone rtomayko/tilt
C
readme  
Chris Wanstrath 已提交
9

M
Mislav Marohnić 已提交
10 11
# expands to:
$ git clone git://github.com/rtomayko/tilt.git
12
```
C
Chris Wanstrath 已提交
13

M
Mislav Marohnić 已提交
14 15
hub is best aliased as `git`, so you can type `$ git <command>` in the shell and
get all the usual `hub` features. See "Aliasing" below.
C
tweak  
Chris Wanstrath 已提交
16

C
Chris Wanstrath 已提交
17

M
Mislav Marohnić 已提交
18 19
Installation
------------
C
Chris Wanstrath 已提交
20

M
Mislav Marohnić 已提交
21
Dependencies:
C
Chris Wanstrath 已提交
22

M
Mislav Marohnić 已提交
23
* **git 1.7.3** or newer
C
tweak  
Chris Wanstrath 已提交
24

25 26
#### Homebrew

27
`hub` can be installed through Homebrew:
28

29
``` sh
30 31 32
$ brew install hub
$ hub version
git version 1.7.6
33 34 35
hub version 2.2.3
```

M
Marek Suscak 已提交
36 37
If you want to get access to new `hub` features earlier and help with its
development by reporting bugs, you can install the prerelease version:
38 39 40 41 42

``` sh
$ brew install --devel hub
```

43
#### Windows (Via Chocolatey)
44 45 46 47 48 49

`hub` can be installed through [Chocolatey](https://chocolatey.org/) on Windows.

``` sh
> choco install hub
> hub version
50 51 52 53 54 55 56 57 58 59 60 61 62
git version 2.16.2.1.windows.1
hub version 2.2.9
```

#### Windows (Via Scoop)

`hub` can be installed through [Scoop](https://scoop.sh/) on Windows.

``` sh
> scoop install hub
> hub version
git version 2.16.2.windows.1
hub version 2.2.9
63
```
64

65 66 67 68 69 70 71 72 73 74 75
#### 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
```

O
Owen Ou 已提交
76 77
#### Standalone

78
`hub` can be easily installed as an executable. Download the latest
79 80
[compiled binaries](https://github.com/github/hub/releases) and put it anywhere
in your executable path.
O
Owen Ou 已提交
81 82 83

#### Source

M
Mislav Marohnić 已提交
84
To install hub from source:
O
Owen Ou 已提交
85

M
Mislav Marohnić 已提交
86
``` sh
O
Owen Ou 已提交
87 88
$ git clone https://github.com/github/hub.git
$ cd hub
M
Mislav Marohnić 已提交
89 90
$ make install prefix=/usr/local
```
O
Owen Ou 已提交
91

M
Marcio Puga 已提交
92
Prerequisites for compilation are:
M
Mislav Marohnić 已提交
93

M
Mislav Marohnić 已提交
94
* `make`
P
Pepper Lebeck-Jobe 已提交
95
* [Go 1.8+](http://golang.org/doc/install)
M
Mislav Marohnić 已提交
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
* Ruby 1.9+ with Bundler - for generating man pages

If you don't have `make`, Ruby, or want to skip man pages (for example, if you
are on Windows), you can build only the `hub` binary:

``` sh
$ ./script/build
```

You can now move `bin/hub` to somewhere in your PATH.

Finally, if you've done Go development before and your `$GOPATH/bin` directory
is already in your PATH, this is an alternative installation method that fetches
hub into your GOPATH and builds it automatically:

``` sh
M
Mislav Marohnić 已提交
112
$ go get github.com/github/hub
M
Mislav Marohnić 已提交
113
```
M
Mislav Marohnić 已提交
114

C
Chris Wanstrath 已提交
115 116
Aliasing
--------
C
readme  
Chris Wanstrath 已提交
117

M
Mislav Marohnić 已提交
118 119
Using hub feels best when it's aliased as `git`. This is not dangerous; your
_normal git commands will all work_. hub merely adds some sugar.
C
readme  
Chris Wanstrath 已提交
120

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

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

126
``` sh
127
eval "$(hub alias -s)"
128
```
C
tweaks  
Chris Wanstrath 已提交
129

130 131
#### PowerShell

P
Pepper Lebeck-Jobe 已提交
132 133
If you're using PowerShell, you can set an alias for `hub` by placing the
following in your PowerShell profile (usually
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
`~/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
```

154 155
### Shell tab-completion

156 157
hub repository contains tab-completion scripts for bash, zsh and fish.
These scripts complement existing completion scripts that ship with git.
158

159 160
[Installation instructions](etc)

M
Mislav Marohnić 已提交
161 162
* [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 已提交
163
* [hub fish completion](https://github.com/github/hub/blob/master/etc/hub.fish_completion)
164

C
Chris Wanstrath 已提交
165 166
Meta
----
C
readme  
Chris Wanstrath 已提交
167

M
Mislav Marohnić 已提交
168 169 170
* Home: <https://github.com/github/hub>
* Bugs: <https://github.com/github/hub/issues>
* Authors: <https://github.com/github/hub/contributors>