Visual Studio Code always asking for git credentials

后端 未结 22 637
悲&欢浪女
悲&欢浪女 2020-11-29 14:50

I started using Visual Studio Code, and I was trying to save my test project into GitHub, but Visual Studio Code is always asking for my GitHub credentials.

I have i

相关标签:
22条回答
  • 2020-11-29 15:15

    Try installing "Git Credential Manager For Windows" (and following instructions for setting up the credential manager).

    When required within an app using Git (e.g. VS Code) it will "magically" open the required dialog for Visual Studio Team Services credential input.

    0 讨论(0)
  • 2020-11-29 15:15

    For windows 10 : go to control panel/Credential manager/ Windows Credential--> click on the git link, --> edit--> update to new password. That should work

    0 讨论(0)
  • 2020-11-29 15:15

    I usually run this simple command to change the git remote url from https to ssh

    git remote set-url origin git@github.com:username/repo-name-here.git
    
    0 讨论(0)
  • 2020-11-29 15:16

    I had a similar problem in Visual Studio Code.

    I solved by changing the remote url to https. (in file .git/config)

    [remote "origin"]
        url = https://user@server.com/plesk-git/project.git
    

    and also

    git config --global credential.helper wincred
    

    pulled again, windows credential popup came out, problems solved.

    0 讨论(0)
  • 2020-11-29 15:17

    Automatic Git authentication. From the v1.45 Release Notes:

    GitHub authentication for GitHub Repositories

    VS Code now has automatic GitHub authentication against GitHub repositories. You can now clone, pull, push to and from public and private repositories without configuring any credential manager in your system. Even Git commands invoked in the Integrated Terminal, for example git push, are now automatically authenticated against your GitHub account.

    You can disable GitHub authentication with the git.githubAuthentication setting. You can also disable the terminal authentication integration with the git.terminalAuthentication setting.

    0 讨论(0)
  • 2020-11-29 15:18

    Use ssh instead of http/https.

    You will need to set ssh keys on your local machine, upload them to your git server and replace the url form http:// to git:// and you will not need to use passwords anymore.

    If you cant use ssh add this to your config:

    [credential "https://example.com"]
        username = me
    

    documents are here.


    Using ssh key in github


    Simply follow those steps and you will set up your ssh key in no time:

    • Generate a new ssh key (or skip this step if you already have a key)
      ssh-keygen -t rsa -C "your@email"

    • Once you have your key set in home/.ssh directory (or Users/<your user>.ssh under windows), open it and copy the content


    How to add sh key to github account?

    • Login to github account
    • Click on the rancher on the top right (Settings)
      github account settigns
    • Click on the SSH keys
      ssh key section
    • Click on the Add ssh key
      Add ssh key
    • Paste your key and save

    And you all set to go :-)

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