Previous: Authentication, Up: API [Contents]
The username and, unless you only use Github.com itself, the Github Enterprise instance have to be configured using Git variables. In rare cases it might also be necessary to specify the identity of the local machine, which is done using a lisp variable.
The Github.com username. This should be set globally and if you have multiple Github.com user accounts, then you should set this locally only for those repositories that you want to access using the secondary identity.
This variable serves the same purpose as github.user
but for the
Github Enterprise instance identified by HOST
.
The reason why separate variables are used is that this makes it possible to set both values globally instead of having to set one of the values locally in each and every repository that is connected to the Github Enterprise instance, not Github.com.
This variable should only be set locally for a repository and specifies the Github Enterprise edition that that repository is connected to. You should not set this globally because then each and every repository becomes connected to the specified Github Enterprise instance, including those that should actually be connected to Github.com.
When this is undefined, then "api.github.com" is used (defined in
the constant ghub-default-host
, which you should never attempt to
change.)
Ghub uses a different token for each quadruple (USERNAME PACKAGE
HOST LOCAL-MACHINE)
. Theoretically it could reuse tokens to some
extent but that would be more difficult to implement, less flexible,
and less secure (though slightly more convenient).
A token is identified on the respective Github instance (Github.com
or a Github Enterprise instance) using the pair (PACKAGE .
LOCAL-MACHINE)
, or more precisely the string "Emacs package PACKAGE
@ LOCAL-MACHINE". USERNAME
and HOST
do not have to be encoded
because the token is stored for USERNAME
on HOST
and cannot be
used by another user and/or on another instance.
There is one potential problem though; for any given (PACKAGE
. LOCAL-MACHINE)
there can only be one token identified by "Emacs
package PACKAGE @ LOCAL-MACHINE"; Github does not allow multiple
tokens with the same description because it uses the description as
the identifier (it could use some hash instead, but alas it does
not).
If you have multiple machines and some of them have the same name, then you should probably change that as this is not how things ought to be. However if you dual-boot, then it might make sense to give that machine the same name regardless of what operating system you have booted into.
You could use the same token on both operating systems, but setting that up might be somewhat difficult because it is not possible to download an existing token from Github. You could, of course, locally copy the token, but that is inconvenient and would make it harder to only revoke the token used on your infected Windows installation without also revoking it for your totally safe *BSD installation.
Alternatively you can set this variable to a unique value, that will
then be used to identify the local machine instead of the value
returned by system-name
.
Previous: Authentication, Up: API [Contents]