[Solved-5 Solutions] Pushing to Git returning Error Code 403 fatal: HTTP request failed - git



Error Description:

    • We can clone a copy of this repo over HTTPS authenticated.
    • We have made some commits and want to come back to the GitHub server. Using Cygwin on Windows 7 x64.
    C:\cygwin\home\XPherior\Code\lunch_call>git push
    Password:
    error: The requested URL returned error: 403 while accessing https://MichaelDrog
    alis@github.com/derekerdmann/lunch_call.git/info/refs
    
    fatal: HTTP request failed
    

    Solution 1:

      Github give the idea it supports ssh way to read & write the repo, whereas https way also displayed 'Read & Write'.

      • Now you need to change your repo config on your PC to ssh way:

      1. Edit .git/config file under your repo directory
      2. Find url=entry under section [remote "origin"]
      3. Change it from url=https://MichaelDrogalis@github.com/derekerdmann/lunch_call.git to url=ssh://git@github.com/derekerdmann/lunch_call.git. ie, change all the texts before @ symbol to ssh://git
      4. Save config file and quit. You can use git push origin master to sync your repo on GitHub

      Solution 2:

        • To login using https protocol, you should first set your authentication credential to the git Remote URI:
        git remote set-url origin https://yourusername@github.com/user/repo.git
        
        • Now you'll be asked for a password when try to git push.
        • In fact, this is on the http authentication format. Now you have to set a password :
        https://youruser:password@github.com/user/repo.git
        
        • You should be aware that your github password will be stored in plaintext in your .git directory, which is undesirable.

        Solution 3:

          • On behalf of editing .git/config file manually, you can use git remote set-url command.
          • In your case it should be:
          git remote set-url origin ssh://git@github.com/derekerdmann/lunch_call.git
          

          Solution 4:

            • Edit .git/config file under your repo directory
            • Find url= entry under section [remote "origin"]
            • Change it from url=https://github.com/rootux/ms-Dropdown.git to https://USERNAME@github.com/rootux/ms-Dropdown.git
            • Where USERNAME is your github user name

            Solution 5:

              • When permission denied 403 error while using ssh(according to Xiao) or http urls you can also try these commands
              git config --global --unset-all credential.helper
              
              git config --unset-all credential.helper
              

              With administrator rights

              git config --system --unset-all credential.helper
              

              Related Searches to Pushing to Git returning Error Code 403 fatal: HTTP request failed