1

After not pushing to my personal github account for a month or so I am now getting the following terminal output when trying to push an initial commit to my newly created Github repo.

remote: Permission to <Me>/<MyRepo>.git denied to <me>. fatal: unable to access 'https://github.com/<Me>/<MyRepo>.git/': The requested URL returned error: 403

Searching google turned up some Github provided documentation instructing me how to resolve SSH issues. Is this potentially an SSH issue given that the repo's url's scheme is http?

More over, I recently have done two things that might have caused this misconfiguration. I've been pushing to a work organization repo under a separate github account. And I'm now using HyperTerm as opposed to Terminal.

So given this context, several things (from my perspective) could explain this push being denied, I'm not sure what approach to begin to take to address it. From the information I've provided, is it sufficient to diagnose the root cause?

Qix - MONICA WAS MISTREATED
  • 14,451
  • 16
  • 82
  • 145
Alex Bollbach
  • 4,370
  • 9
  • 32
  • 80

3 Answers3

1

Since you're using multiple GitHub accounts, you'll want to make sure to specify when you clone the project. I'd recommend cloning into a new directory with git clone https://<insert username>@github.com/<insert username/organization>/<insert repository name>. Now git will ask you for your credentials for your personal account (instead of the other account you've been using).

EDIT 1: OP found that deleting the Github user in the macOS keychain solved the problem (short-term fix) https://superuser.com/questions/1064197/how-to-switch-git-user-at-terminal

jackar
  • 724
  • 5
  • 16
  • "(instead of the other account you've been using)." It doesn't ask for credentials in either case. Also, I'm not cloning here. I have a local Repo that I want to push to a newly created GitHub repo. – Alex Bollbach Jun 21 '17 at 01:30
  • i keep reading that i have to "enter your password" if you are pushing to an HTTP repo but I can't find out how to provoke the password prompt. – Alex Bollbach Jun 21 '17 at 01:34
  • I see, have you tried this: https://stackoverflow.com/questions/7548158/having-trouble-switching-github-accounts-on-terminal? – jackar Jun 21 '17 at 01:37
  • 1
    Also, this is a short term fix: https://superuser.com/questions/1064197/how-to-switch-git-user-at-terminal – jackar Jun 21 '17 at 01:38
  • The short term answer worked. Deleting items in Keychain to provoke an opportunity to reset the associated Github account with Git was not something I would have found quickly. So thanks. I suppose at this point, for long term solutions, it seems most people prefer SSH (which I find confusing) over HTTP because you don't have to constantly enter credentials and the CLI prompt. – Alex Bollbach Jun 21 '17 at 01:44
  • Happy to help. Yeah, it might make sense to learn SSH. Trust me, it's worth it in the long run ;) – jackar Jun 21 '17 at 15:44
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/147297/discussion-between-alex-bollbach-and-jackar). – Alex Bollbach Jun 21 '17 at 17:35
0

Searching google turned up some Github provided documentation instructing me how to resolve SSH issues. Is this potentially an SSH issue given that the repo's url's scheme is http?

This is definitely not an SSH issue, because the repositories scheme is HTTP. Rather, this is an HTTPS issue with your authentication.

You probably need to clear your credential cache.

Given what you said about "pushing... under a separate github account," you may have cached your GitHub credentials with a credential helper. To see what credential helper you are using, run this command:

$ git config --get credential.helper

For instance, if the output is manager, then you're using the Windows Credential Store. The answer to remove credentials from git explains how to clear a credential cache.

Shaun Luttin
  • 133,272
  • 81
  • 405
  • 467
  • Thank you. I mentioned my skepticism that it was SSH given the URL Scheme. – Alex Bollbach Jun 21 '17 at 01:25
  • @AlexBollbach Any luck with this? – Shaun Luttin Jun 21 '17 at 01:51
  • 1
    some. Look at my response to @jackar. It seems that deleting certain items from the keychain access provokes git into asking for your credentials again. It was clear from reading his link and inspecting my push failure log that git through I was on my work GH account. So for now, I was able to reset the auth to my personal account. Looks like I'll have to either learn the SSH approach, or find a way to easily toggle between my work and personal http/github auth. – Alex Bollbach Jun 21 '17 at 01:56
0

403 response code is a generic "forbidden" and it could be caused by quite a few things.

If your organization or employer requires certain authentication you'll need to generate an access token with correct permissions.

It could also be caused by having an incorrect remote repository specified. You can verify this with git remote -v

mx1010
  • 1
  • 2