git push origin master Missing or invalid credentials

12,343

Solution 1

I had this error yesterday using the built in terminal in VScode. My issue was that vscode was prompting me for my github username and password at the top of VScode, and not in the terminal. I just didn't see the input field and the auth connection eventually timed out in the terminal.

Solution 2

Missing or invalid credentials. Error: socket hang up.

VS code always reset the git password when you close the application. When you try to push, along with this error, there is a popup box in the top asking again the git password. Enter your git password and push again.

Solution 3

After Reinstallation you need to set your git credentails once again , add VSCode permission to github account.

before pushing to a remote repository from Vscode or git after restarting your computer , you need to set it first by running following command

git remote set-url origin <repo link>

git remote set-url origin https://<your github username>:<your password>@github.com/<your github username>/<your github repository name>.git

If this still dosen't work reloading VSCode and running this again would help.

additionally you can run the commands in git bash to commit and push changes. This works for me every time

Share:
12,343
hexphp111
Author by

hexphp111

Self-taught, I started to create my professional project in 2016, and I constantly evolved with technological advances with great independence, keeping me regularly informed on twitter: @protonwebmaster, to learn effectively and very quickly, for finally succeed in setting up my professional project: Webmaster. This project will gradually adapt to technological realities, and what characterizes it, to present new products. So I work in this direction, research and test the future projects condensed here: protonwebmaster.com.

Updated on July 21, 2022

Comments

  • hexphp111
    hexphp111 almost 2 years

    Cannot push anymore to origin master, git push origin master, since a few days, I have uninstalled git and Visual Code and reinstalled it but nothing, I'v got same error :

    Missing or invalid credentials.
    Error: socket hang up
        at connResetException (internal/errors.js:559:14)
        at Socket.socketOnEnd (_http_client.js:433:23)
        at Socket.emit (events.js:208:15)
        at endReadableNT (_stream_readable.js:1168:12)
        at processTicksAndRejections (internal/process/task_queues.js:77:11) {
      code: 'ECONNRESET'
    }
    

    I do not understand this behavior, because on my other computer everything works, and no GitHub files are corrupted.

    here is my configuration : Ubuntu 18.04.4 LTS

    Need some help please !

  • Daemon Painter
    Daemon Painter almost 4 years
    is this a post to promote gitkraken? Your issue is with credential/network access. The GUI tool managing git has nothing to do with the answer.
  • Sarfraz
    Sarfraz over 3 years
    Thanks, the VScode prompt for the password is really weird.
  • SirSaleh
    SirSaleh over 3 years
    man you saved my day! :)))))))))))))))))))) it's so funny issue.
  • Andreas L.
    Andreas L. over 3 years
    Check the following instructions to avoid this behavior in VS Code for good, so that you can even carry out git pushs and pulls using your VS Code integrated terminal: stackoverflow.com/a/65252723/12298276. If you work with the JSON-settings file, insert the following line into it: git.terminalAuthentication: false, otherwise check the link for how to uncheck this option in the file -> settings.
  • Andreas L.
    Andreas L. over 3 years
    In case you would like to avoid this behavior in VS Code, open the JSON-settings file and insert the following line into it: git.terminalAuthentication: false
  • Cadet
    Cadet about 3 years
    Saved me a lot of time! Thanks!
  • Ram Pasala
    Ram Pasala almost 3 years
    @hexphp111 please accept this answer so that it would help others
  • greendino
    greendino almost 3 years
    for me. this was not the solution. still getting the error