Next: , Up: Getting Started   [Contents]


2.1 Setting the Username

If you haven’t set the Git variable github.user yet when making a request, then you will be asked:

Git variable `github.user' is unset.  Set to:

You are expected to provide your Github username here. The provided value will be saved globally (using git config --global github.user USERNAME).

If you need to identify as another user in a particular repository, then you have to set that variable locally, before making a request:

cd /path/to/repo
git config github.user USERNAME

For Github Enterprise instances you have to specify where the API can be accessed before you try to access it and a different variable has to be used to set the username. For example if the API is available at https://example.com/api/v3, then you should do this:

# Do this once
git config --global github.example.com/api/v3.user EMPLOYEE

# Do this for every corporate repository
cd /path/to/repo
git config github.host example.com/api/v3

If you do not set github.example.com/api/v3.user, then you will be asked to provide the value when trying to make a request, but you do have to manually set github.host, or Ghub assumes that you are trying to access api.github.com.