Next: , Previous: , Up: Getting Started   [Contents][Index]


2.2 Setting the Username

Ghub needs to know your username that you use on the host that you want it to connect to. For each host a different Git variable has to be set to specify the username on that host. More than one variable is needed because you might use different usernames on different hosts.

2.2.1 Setting your Github.com Username

To inform Ghub about your "github.com" username do this:

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:

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

2.2.2 Setting your Gitlab.com Username

To inform Ghub about your "gitlab.com" username do this:

git config --global gitlab.user USERNAME

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

cd /path/to/repo
git config --local gitlab.user USERNAME

Make sure you use the correct USERNAME for this forge/host. It might not be the same as on "github.com"!

2.2.3 Setting your Github Enterprise Username

For Github Enterprise instances you have to specify where the API can be accessed 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:

git config --global github.example.com/api/v3.user USERNAME

Make sure you use the correct USERNAME for this instance. It might not be the same as on "github.com"!

Doing this only tells Ghub who you are on this host, additionally you have to tell Ghub which repository are connected to that forge/host, like so:

cd /path/to/repo
git config --local github.host example.com/api/v3

2.2.4 Setting your Username for Other Hosts and/or Forges

To inform Ghub about your username on HOST (a FORGE instance) do this:

git config --global FORGE.HOST.user USERNAME

FORGE can be one of bitbucket, gitea or gogs. It can also be github or gitlab; but if that is the case, then you should look at the preceding sections instead, which discuss these cases specifically.

HOST identifies the instance. This actually points at the top-level endpoint of the API and may contain path components, e.g.: example.com/api.

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

cd /path/to/repo
git config --global FORGE.HOST.user USERNAME

Next: , Previous: , Up: Getting Started   [Contents][Index]