Reputation: 416
I'm attempting to make the initial commit to my organizations repo. When I enter the command:
$git push -u origin master
This error message is returned:
remote: Permission to (my-work-username)/Team-Website.git denied to (my-personal-username). fatal: unable to access 'https://github.com/(my-work-username)/Team-Website.git/': The requested URL returned error: 403
I've changed my username and email using:
$git config --global user.name "my-work-username"
$git config --global user.email "my-work-email"
And verified them using:
$git config --list
Which returned:
user.name=(my-work-username) user.email=(my-work-email)
So I want to push my directory to the repo, although the 403 error occurs, preventing this, because it doesn't recognize my current username as matched the authorized username for that repo.
What should I try to get github to recognize the authorized and active usernames match?
Upvotes: 0
Views: 83
Reputation: 2590
The configuration from git config
affects your local settings, such as the name and email that show up on your commits. They do not affect the username used for github.
Check the URL of your origin
:
git remote -v
You will likely see something like origin https://github.com/GithubUsername/GithubRepoName.git (push)
. Then you can add your Github username for HTTPS authentication into the url, by changing it, like this:
git remote set-url origin https://[email protected]/Githubusername/GithubReponame.git
Then, when you push or fetch, you'll be prompted for the password.
This assumes you're using HTTPS authentication and do not have 2FA enabled.
Upvotes: 1