Github remote permission denied

后端 未结 5 1065
小蘑菇
小蘑菇 2020-11-28 03:23

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

相关标签:
5条回答
  • 2020-11-28 04:00
    1. Multiple users generate their own ssh key, Generating a new SSH key and adding it to the ssh-agent

    2. Adding a new SSH key to your GitHub account

    3. 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 connection
      • Git other operations
    4. Bob 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 connection
      • Git other operations
    0 讨论(0)
  • 2020-11-28 04:15

    If you are using MacOS, you can

    1. go to KeyChain Access,
    2. Search for "GitHub",
    3. then when then result "github.com" pops up, change the account or password to your new account, and save.

    Then you are all set!

    0 讨论(0)
  • 2020-11-28 04:16

    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>
    
    0 讨论(0)
  • 2020-11-28 04:22

    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.

    0 讨论(0)
  • 2020-11-28 04:22

    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

    0 讨论(0)
提交回复
热议问题