1hub(1) hub manual hub(1)
2
3
4
6 hub - make git easier with GitHub
7
9 hub [--noop] COMMAND [OPTIONS]
10 hub alias [-s] [SHELL]
11 hub help hub-COMMAND
12
14 Hub is a tool that wraps git in order to extend it with extra
15 functionality that makes it better when working with GitHub.
16
18 Available commands are split into two groups: those that are already
19 present in git but that are extended through hub, and custom ones that
20 hub provides.
21
22 Extended git commands
23 hub-am(1)
24 Replicate commits from a GitHub pull request locally.
25
26 hub-apply(1)
27 Download a patch from GitHub and apply it locally.
28
29 hub-checkout(1)
30 Check out the head of a pull request as a local branch.
31
32 hub-cherry-pick(1)
33 Cherry-pick a commit from a fork on GitHub.
34
35 hub-clone(1)
36 Clone a repository from GitHub.
37
38 hub-fetch(1)
39 Add missing remotes prior to performing git fetch.
40
41 hub-init(1)
42 Initialize a git repository and add a remote pointing to GitHub.
43
44 hub-merge(1)
45 Merge a pull request locally with a message like the GitHub Merge
46 Button.
47
48 hub-push(1)
49 Push a git branch to each of the listed remotes.
50
51 hub-remote(1)
52 Add a git remote for a GitHub repository.
53
54 hub-submodule(1)
55 Add a git submodule for a GitHub repository.
56
57 New commands provided by hub
58 hub-alias(1)
59 Show shell instructions for wrapping git.
60
61 hub-api(1)
62 Low-level GitHub API request interface.
63
64 hub-browse(1)
65 Open a GitHub repository in a web browser.
66
67 hub-ci-status(1)
68 Display status of GitHub checks for a commit.
69
70 hub-compare(1)
71 Open a GitHub compare page in a web browser.
72
73 hub-create(1)
74 Create a new repository on GitHub and add a git remote for it.
75
76 hub-delete(1)
77 Delete a repository on GitHub.
78
79 hub-fork(1)
80 Fork the current repository on GitHub and add a git remote for it.
81
82 hub-gist(1)
83 Create and print GitHub Gists.
84
85 hub-pull-request(1)
86 Create a GitHub Pull Request.
87
88 hub-pr(1)
89 Manage GitHub Pull Requests for the current repository.
90
91 hub-issue(1)
92 Manage GitHub Issues for the current repository.
93
94 hub-release(1)
95 Manage GitHub Releases for the current repository.
96
97 hub-sync(1)
98 Fetch git objects from upstream and update local branches.
99
101 Most hub commands are supposed to be run in a context of an existing
102 local git repository. Hub will automatically detect the GitHub
103 repository that the current working directory belongs to by scanning
104 its git remotes.
105
106 In case there are multiple git remotes that are all pointing to GitHub,
107 hub assumes that the main one is named "upstream", "github", or
108 "origin", in that order of preference.
109
110 When working with forks, it´s recommended that the git remote for your
111 own fork is named "origin" and that the git remote for the upstream
112 repository is named "upstream". See
113 ⟨https://help.github.com/articles/configuring-a-remote-for-a-fork/⟩
114
115 The default branch (usually "master") for the current repository is
116 detected like so:
117
118 git symbolic-ref refs/remotes/origin/HEAD
119
120 where origin is the name of the git remote for the upstream repository.
121
122 The destination where the currently checked out branch is considered to
123 be pushed to depends on the git config push.default setting. If the
124 value is "upstream" or "tracking", the tracking information for a
125 branch is read like so:
126
127 git rev-parse --symbolic-full-name BRANCH@{upstream}
128
129 Otherwise, hub scans git remotes to find the first one for which
130 refs/remotes/REMOTE/BRANCH exists. The "origin", "github", and
131 "upstream" remotes are searched last because hub assumes that it´s more
132 likely that the current branch is pushed to your fork rather than to
133 the canonical repo.
134
136 GitHub OAuth authentication
137 Hub will prompt for GitHub username password the first time it needs
138 to access the API and exchange it for an OAuth token, which it saves in
139 ~/.config/hub.
140
141 To avoid being prompted, use GITHUB_USER and GITHUB_PASSWORD
142 environment variables.
143
144 Alternatively, you may provide GITHUB_TOKEN, an access token with repo
145 permissions. This will not be written to ~/.config/hub.
146
147 HTTPS instead of git protocol
148 If you prefer the HTTPS protocol for git operations, you can configure
149 hub to generate all URLs with https: instead of git: or ssh::
150
151 $ git config --global hub.protocol https
152
153 This will affect clone, fork, remote add and other hub commands that
154 expand shorthand references to GitHub repo URLs.
155
156 GitHub Enterprise
157 By default, hub will only work with repositories that have remotes
158 which point to github.com. GitHub Enterprise hosts need to be
159 whitelisted to configure hub to treat such remotes same as github.com:
160
161 $ git config --global --add hub.host MY.GIT.ORG
162
163 The default host for commands like init and clone is still github.com,
164 but this can be affected with the GITHUB_HOST environment variable:
165
166 $ GITHUB_HOST=my.git.org git clone myproject
167
168 Environment variables
169 HUB_VERBOSE
170 If this environment variable is set, verbose logging will be
171 printed to stderr.
172
173 HUB_CONFIG
174 The file path where hub configuration is read from and stored. If
175 XDG_CONFIG_HOME is present, the default is $XDG_CONFIG_HOME/hub;
176 otherwise it´s $HOME/.config/hub. The configuration file is also
177 searched for in XDG_CONFIG_DIRS per XDG Base Directory
178 Specification.
179
180 HUB_PROTOCOL
181 One of "https", "ssh", or "git" as preferred protocol for git
182 clone/push.
183
184 GITHUB_HOST
185 The GitHub hostname to default to instead of "github.com".
186
187 GITHUB_TOKEN
188 OAuth token to use for GitHub API requests.
189
190 GITHUB_USER
191 The GitHub username of the actor of GitHub API operations.
192
193 GITHUB_PASSWORD
194 The GitHub password used to exchange user credentials for an OAuth
195 token that gets stored in hub configuration. If not set, it may be
196 interactively prompted for on first run.
197
198 GITHUB_REPOSITORY
199 A value in "OWNER/REPO" format that specifies the repository that
200 API operations should be performed against. Currently only used to
201 infer the default value of GITHUB_USER for API requests.
202
204 ⟨https://github.com/github/hub/issues⟩
205
207 ⟨https://github.com/github/hub/contributors⟩
208
210 git(1), git-clone(1), git-remote(1), git-init(1),
211 ⟨https://github.com/github/hub⟩
212
213
214
215
216hub version 2.14.2 22 Jul 2021 hub(1)