README.md 4.0 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
# expands to:
M
Mislav Marohnić 已提交
15
#=> 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

J
Jamie Strusz 已提交
24
hub can also be used to make shell scripts that [manually interface with the
M
Mislav Marohnić 已提交
25 26
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 35 36 37 38 39 40
platform | manager | command to run
---------|---------|---------------
macOS, Linux | [Homebrew](https://docs.brew.sh/Installation) | `brew install hub`
Windows | [Scoop](http://scoop.sh/) | `scoop install hub`
Windows | [Chocolatey](https://chocolatey.org/) | `choco install hub`
Fedora Linux | [DNF](https://fedoraproject.org/wiki/DNF) | `sudo dnf install hub`
Arch Linux | [pacman](https://wiki.archlinux.org/index.php/pacman) | `sudo pacman -S hub`
FreeBSD | [pkg(8)](http://man.freebsd.org/pkg/8) | `pkg install hub`
41
Debian | [apt(8)](https://manpages.debian.org/buster/apt/apt.8.en.html) | `sudo apt install hub`
42
Ubuntu | [Snap](https://snapcraft.io) | `snap install hub --classic`
43

44
#### Standalone
O
Owen Ou 已提交
45

46
`hub` can be easily installed as an executable. Download the latest
47 48
[compiled binaries](https://github.com/github/hub/releases) and put it anywhere
in your executable path.
O
Owen Ou 已提交
49 50 51

#### Source

52 53 54 55 56 57
Prerequisites for building from source are:

* `make`
* [Go 1.9+](https://golang.org/doc/install)

Clone this repository and run `make install`:
O
Owen Ou 已提交
58

59 60 61 62 63
```sh
git clone \
  --config transfer.fsckobjects=false \
  --config receive.fsckobjects=false \
  --config fetch.fsckobjects=false \
64 65 66
  https://github.com/github/hub.git

cd hub
67
make install prefix=/usr/local
M
Mislav Marohnić 已提交
68
```
O
Owen Ou 已提交
69

70 71 72 73
This assumes support for [Go 1.11+
modules](https://github.com/golang/go/wiki/Modules). If you are building on an
older version of Go, you will need to clone the repository into
`$GOPATH/src/github.com/github/hub`.
M
Mislav Marohnić 已提交
74

C
Chris Wanstrath 已提交
75 76
Aliasing
--------
C
readme  
Chris Wanstrath 已提交
77

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

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

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

86
``` sh
87
eval "$(hub alias -s)"
88
```
C
tweaks  
Chris Wanstrath 已提交
89

90 91
#### PowerShell

P
Pepper Lebeck-Jobe 已提交
92 93
If you're using PowerShell, you can set an alias for `hub` by placing the
following in your PowerShell profile (usually
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
`~/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
```

114 115
### Shell tab-completion

116 117
hub repository contains tab-completion scripts for bash, zsh and fish.
These scripts complement existing completion scripts that ship with git.
118

119 120
[Installation instructions](etc)

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

C
Chris Wanstrath 已提交
125 126
Meta
----
C
readme  
Chris Wanstrath 已提交
127

M
Mislav Marohnić 已提交
128 129 130
* Home: <https://github.com/github/hub>
* Bugs: <https://github.com/github/hub/issues>
* Authors: <https://github.com/github/hub/contributors>