I\'m trying to upload my repo on github and go through all the steps upto:
git push -u origin master
at that point it gives me the following er
Multiple users generate their own ssh key, Generating a new SSH key and adding it to the ssh-agent
Adding a new SSH key to your GitHub account
Alice Repository, git bash:
git config user.name "Alice"
git config user.email "alice@email.com"
eval $(ssh-agent -s)
, ssh-add ~/.ssh/alice.private
ssh -T git@github.com
, Testing your SSH connectionBob Repository, git bash:
git config user.name "Bob"
git config user.email "bob@email.com"
eval $(ssh-agent -s)
, ssh-add ~/.ssh/bob.private
ssh -T git@github.com
, Testing your SSH connectionIf you are using MacOS, you can
Then you are all set!
Unable to access https means: this has nothing to do with SSH (and switching to SSH, while possible, does not explain the original issue)
This has to do with credential caching, meaning Git will be default provide the credentials (GitHub account and password) of the old account while you are trying to push to the new account.
See if you have a credential helper that would have cached your (old account) credentials (username/password) used to authentication you.
git config credential.helper
On Mac, as commented by Arpit J, just goto/open your keychain access->search for github.com related file->and edit credentials there.
See "Updating credentials from the OSX Keychain"
On Windows for example, that would be the Windows Credential Managers.
Open the Windows Credential Store, and see if the first user is registered there: delete that entry, and you will be able to authenticate with the second user.
(Here is an example for BitBucket)
In command-line (see git credential):
git credential reject protocol=https host=github.com <empty line here>
and then to set the new username & password:
git credential fill protocol=https host=github.com <empty line here>
I'm not sure what the issue is, but since you mentioned not knowing what having the "right keys installed" means, I'm going to assume you have not set up your computer to authenticate to your Github repository via SSH.
This guide should show you how to do that: Adding a new SSH key to your Github account
Also, I would suggesting using 'git://github.com/samrao2/manager-4.git/' for your remote URL rather than 'https://github.com/samrao2/manager-4.git/'. The latter requires you to enter a password each time, whereas the former will authenticate via SSH, which is far less irritating. You can change the remote URL in your repository to use the git protocol, instead of https, by typing:
git remote set-url origin git://github.com/samrao2/manager-4.git
from within your project directory.
The problem is you are trying to push into new github account using old github account's ssh key, so generate a new SSH key for the new github account using this link https://help.github.com/en/github/authenticating-to-github/error-permission-to-userrepo-denied-to-userother-repo and then add it your github account. After this try to push, it works