smeeb
smeeb

Reputation: 29487

Where does GitHub read usernames/accounts from in the dreaded permission error?

When you push local changes to GitHub, and on the terminal, git gives you the following error on push:

remote: Permission to someorg/somerepo.git denied to someuser.

...where is someuser being read or derived from? Which config file?

Upvotes: 0

Views: 77

Answers (1)

torek
torek

Reputation: 487993

where is someuser being read or derived from? Which config file?

When you connect to GitHub for push, you must authenticate yourself. There are several ways to do that and you have not shown which one you are using. (Note that other connections to GitHub may require authentication as well, depending on whether the repository is public.)

If you are authenticating over https://, Git will use various credential helpers, which may store user names and/or passwords. You can configure which credential helper to use, including the "cache" and "store" helpers, which use different additional data. Note that the available set of credential helpers varies based on your underlying operating system as well.

If you are authenticating over ssh://, you always ask GitHub to use the user name [email protected], and the actual user ID is determined by GitHub based on the ssh key you provide. Each key has a (single) user associated with it.

[Edit to add] Use git remote show origin to show the fetch and push URLs for origin:

$ git remote show origin
* remote origin
  Fetch URL: [email protected]:path/to/repo.git
  Push  URL: [email protected]:path/to/repo.git

If the URL begins with [email protected]: or ssh://[email protected]/, you are using ssh. If the URL begins with https://github.com/, you are using https.

For more basics and links, see the GitHub setup help page.

Upvotes: 1

Related Questions