항상 git 자격 증명을 요구하는 Visual Studio Code
Visual Studio Code 사용을 시작했으며 테스트 프로젝트를 GitHub 에 저장하려고 했지만 Visual Studio Code 는 항상 GitHub 자격 증명을 요구합니다 .
내 PC GitHub Desktop에 설치하고 Git 도 이미 실행했습니다.
git config --global credential.helper wincred
그러나 여전히 Visual Studio Code 는 자격 증명을 요구하고 있습니다.
어떤 도움?
다음은 사용자 프로필 folfer에있는 내 .gitconfig 파일입니다.
[filter "lfs"]
clean = git-lfs clean %f
smudge = git-lfs smudge %f
required = true
[user]
name = ddieppa
[user]
email = fake@live.com
[credential]
helper = wincred
자격 증명을 요구하는 팝업 창은 다음과 같습니다.
팝업에 GitHub 자격 증명을 입력 했지만 Visual Studio Code 의 Git 출력 창 에이 오류가 계속 발생합니다 .
remote: Anonymous access to ddieppa/LineOfBizApp.git denied.
fatal: Authentication failed for 'https://github.com/ddieppa/LineOfBizApp.git/'
최근 업데이트 된 답변 @ 05 년 3 월 5 일
98 개의 공감 후, 나는 설명과 함께 진정한 대답을해야한다고 생각합니다.
VS 코드가 비밀번호를 묻는 이유는 무엇입니까? VSCode는 자동 가져 오기 기능을 실행하지만 git 서버에는 신원을 인증 할 정보가 없습니다. 다음과 같은 경우에 발생합니다.
- git repo에
https
원격 URL이 있습니다. 예! 이런 종류의 리모콘은 매번 당신에게 절대적으로 묻습니다. 예외는 없습니다! 아래 솔루션으로 인증을 캐시하기위한 임시 트릭을 수행 할 수 있지만 권장하지는 않습니다. - git repo에
ssl
원격 URL이 있지만 ssh 공개 키를 git 서버에 복사하지 않았습니다.ssh-keygen
키를 생성하고 git 서버에 복사하는 데 사용하십시오 . 끝난! 이 솔루션은 터미널에서 암호를 다시 입력하지 않아도됩니다. @Fnatical하여 좋은 명령을 참조하십시오 여기에 대한 답변을.
이 답변의 끝에 업데이트 된 부분은 전혀 도움이되지 않습니다. 워크 플로가 정체되는 것을 제외하고. VSCode에서 발생하는 일만 중지 하고이 일이 터미널에서 발생하도록합니다.
이 잘못된 답변이 오랫동안 귀하에게 영향을 미쳤다면 죄송합니다.
-
원래 답변 (나쁜)
VSCode 문서 에서 해결책을 찾았습니다 .
팁 : VS Code가 Git 리모컨과 통신 할 때마다 자격 증명을 요청하지 않도록 자격 증명 도우미 를 설정해야합니다 . 이 작업을 수행하지 않으면 ... 메뉴에서 자동 가져 오기 비활성화를 고려하여 표시되는 프롬프트 수를 줄일 수 있습니다.
따라서 자격 증명 도우미를 켜면 Git이 암호를 메모리에 한동안 저장합니다. 기본적으로 Git은 15 분 동안 비밀번호를 캐시합니다.
터미널에 다음을 입력하십시오.
git config --global credential.helper cache
# Set git to use the credential memory cache
기본 비밀번호 캐시 제한 시간을 변경하려면 다음을 입력하십시오.
git config --global credential.helper 'cache --timeout=3600'
# Set the cache to timeout after 1 hour (setting is in seconds)
최신 정보
위와 동일하게 VS 코드와 구성을 설치했지만 @ddieppa가 말했듯이 나에게도 효과가 없었습니다. 그래서 User Setting에서 옵션을 찾으려고했는데 "git.autofetch"= true를 보았습니다. 이제 false로 설정하십시오! VS 코드는 더 이상 암호를 다시 반복해서 입력 할 필요가 없습니다!
In menu, click File / Preferences / User Setting And type these:
Place your settings in this file to overwrite the default settings
{
"git.autofetch": false
}
You should be able to set your credentials like this:
git remote set-url origin https://<USERNAME>:<PASSWORD>@bitbucket.org/path/to/repo.git
You can get the remote url like this:
git config --get remote.origin.url
This has been working for me:
1. Set credential hepler to store
$ git config --global credential.helper store
2. then verify if you want:
$ git config --global credential.helper store
Simple example when using git bash quoted from Here (works for current repo only, use --global
for all repos)
$ git config credential.helper store
$ git push http://example.com/repo.git
Username: < type your username >
Password: < type your password >
[several days later]
$ git push http://example.com/repo.git
[your credentials are used automatically]
Will work for VS Code too.
More detailed example and advanced usage here.
Note: Username & Passwords are not encrypted and stored in plain text format so use it on your personal computer only.
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.
All I had to do was to run this command:
git config --global credential.helper wincred
Then I was prompted for password twice.
Next time it worked without prompting me for password.
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 (orUsers/<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)
- Click on the
SSH keys
- Click on the
Add ssh key
- Paste your key and save
And you all set to go :-)
The following steps walk you through how to:
- Generate SSH keys (without passphrase**)
- Add the public key generated in step 1 to your Git repository
- Confirm the above steps have been completed successfully
- Make your first commit (without having to provide a username / password)
**Generating SSH keys without a passphrase is unwise if your work is particularly sensitive.
OS - Fedora 28 | Editor - VS Code v1.23.0 | Repository - Git
Generate SSH keys:
ssh-keygen -t rsa -C "email@goeshere.com"
- Enter file in which to save the key: Press Enter
- Enter passphrase: Press Enter
- Enter same passphrase again: Press Enter
After completing the above steps, the location of your public key is shown in the terminal window. If the currently logged in user is 'bob' the location of your public key would be /home/bob/.ssh/id_rsa.pub
Copy and import public key to GitHub:
cat /home/bob/.ssh/id_rsa.pub
Copy the whole public key that is now displayed in your terminal window to the clipboard
- Go to https://github.com and sign in
- Click the user icon in the top right corner of the screen and select Settings
- Click SSH and GPG keys
- Click New SSH key
- Enter a title, paste the public key copied to the clipboard in the first bullet point, and click Add SSH key
Confirm the above steps:
ssh -T git@github.com
yes
Hi ! You've successfully authenticated, but GitHub does not provide shell access.
First commit / push without having to enter a username / password: - touch test.txt
git add test.txt
git commit
- opens editor, enter a message and save the file. If vi is your editor, pressi
once the file opens, enter a message, press esc, and then enter:x
to save changes.git push
The only hiccup you may encounter is when you attempt to SSH to GitHub. This link will provide some assistance -
Happy hunting!
For windows 10 : go to control panel/Credential manager/ Windows Credential--> click on the git link, --> edit--> update to new password. That should work
Use an SSH key without a passphrase.
Maybe this is obvious to some (wasn't to me). It also doesn't solve the issue if you absolutely require a passphrase, but this was a decent compromise in my situation on Mac.
After fighting with something like this for a little while, I think I came up with a good solution, especially when having multiple accounts across both GitHub and BitBucket. However for VSCode, it ultimately ended up as start it from a Git Bash terminal so that it inherited the environment variables from the bash session and it knew which ssh-agent to look at.
I realise this is an old post but I still really struggled to find one place to get the info I needed. Plus since 2017, ssh-agent got the ability to prompt you for a passphrase only when you try to access a repo.
I put my findings down here if anyone is interested:
Following that article:
You may just set GIT_SSH env. var. to the Putty's plink.exe program. (Then use the pageant.exe as a auth. agent)
Solve the issue by following steps.
Uninstalled softwares Vscode and git and reinstalled the same. Changed the git repository clone url from ssh to https.
For me I had setup my remote repo with an SSH key but git could not find them because the HOMEDRIVE environment variable was automatically getting set to a network share due to my company's domain policy. Changing that environment variable in my shell prior to launching code .
caused VSCode to inherit the correct environment variable and viola no more connection errors in the git output window.
Now I just have to figure out how to override the domain policy so HOMEDRIVE is always pointing to my local c:\users\marvhen
directory which is the default location for the .ssh
directory.
I managed to stop this by carrying out the following steps.
- Uninstall Git Desktop (Not sure this is necessary)
- Uninstall Credentials Manager
cd "C:\Program Files\Git\mingw64\libexec\git-core"
followed bygit-credential-manager.exe uninstall
- Reset credentials helper to use wincred
git config --global credential.helper wincred
- User VS Code to Push some changes and re-input credentials.
NOTE: I was using a Personal Access Token as my password.
I solved a similar problem in a simple way:
- Go To CMD or Terminal
- Type
git pull origin master
. Replace 'origin' with your Remote name - It will ask for the credentials. Type it.
That's all. I Solved the problem
apart from adding the ssh config entries above
if windows
Set-Service ssh-agent -StartupType Automatic
in powershell now the vs code should not prompt...
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.
In general, you can use the built-in credential storage facilities:
git config --global credential.helper store
Or, if you're on Windows, you can use their credential system:
git config --global credential.helper wincred
Or, if you're on MacOS, you can use their credential system:
git config --global credential.helper osxkeychain
첫 번째 솔루션은 대부분의 상황에서 최적입니다.
참고 URL : https://stackoverflow.com/questions/34400272/visual-studio-code-always-asking-for-git-credentials
'Programing' 카테고리의 다른 글
기본 ES6 약속에서 Bluebird Promise.finally에 해당하는 것은 무엇입니까? (0) | 2020.06.04 |
---|---|
IIS를 디버깅 할 때 Visual Studio Attach 보안 경고 해제 (0) | 2020.06.04 |
IEntityChangeTracker의 여러 인스턴스에서 엔티티 오브젝트를 참조 할 수 없습니다. (0) | 2020.06.04 |
의존적으로 타이핑하지 않는 이유는 무엇입니까? (0) | 2020.06.04 |
“node_modules”폴더가 git 저장소에 포함되어야합니다 (0) | 2020.06.04 |