Visual Studio Code always asking for git credentials

后端 未结 22 746
悲&欢浪女
悲&欢浪女 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: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/.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 :-)

提交回复
热议问题