Answers:
好的,我发现您需要避免在Git for Windows安装程序期间选中“ Git Credential Manager”复选框,或者(在安装后)以管理员身份运行Bash shell 并用于git config --edit --system
删除该helper = manager
行,以便不再将其注册为凭证助手。
对于奖励积分,请使用git config --edit --global
并插入:
[core]
askpass =
也要禁用OpenSSH凭据弹出窗口。
git config --system --unset credential.helper
Tools -> Options -> Git
。
我不得不与VSTS一起使用的另一个选项:
git config credential.modalprompt false --global
git pull
由于WCM脱壳,我无法执行操作。使用此选项,我可以享受两个世界:与服务器(或与远程桌面)物理连接的WCM,并能够从ssh客户端提取。
它对我不起作用:
C:\Program Files\Git\mingw64\libexec\git-core
git-credential-manager.exe uninstall
Looking for Git installation(s)...
C:\Program Files\Git
Updated your /etc/gitconfig [git config --system]
Updated your ~/.gitconfig [git config --global]
Removing from 'C:\Program Files\Git'.
removal failed. U_U
Press any key to continue...
但是带有--force
标志就可以了:
C:\Program Files\Git\mingw64\libexec\git-core
git credential-manager uninstall --force
08:21:42.537616 exec_cmd.c:236 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
e
08:21:42.538616 git.c:576 trace: exec: git-credential-manager uninstall --force
08:21:42.538616 run-command.c:640 trace: run_command: git-credential-manager uninstall --force
Looking for Git installation(s)...
C:\Program Files\Git
Updated your /etc/gitconfig [git config --system]
Updated your ~/.gitconfig [git config --global]
Success! Git Credential Manager for Windows was removed! ^_^
Press any key to continue...
运行后,我可以看到该跟踪:
set git_trace=1
我还添加了Git用户名:
git config --global credential.username myGitUsername
然后:
C:\Program Files\Git\mingw64\libexec\git-core
git config --global credential.helper manager
最后,我输入以下命令:
git config --global credential.modalPrompt false
我检查SSH代理是否正在运行-打开Bash窗口以运行此命令
eval "$(ssh-agent -s)"
然后在.ssh所在的计算机users / yourName文件夹中,添加一个连接(仍在Bash中):
ssh-add .ssh/id_rsa
or
ssh-add ~/.ssh/id_rsa(if you are not in that folder)
我检查了上面添加的所有设置:
C:\Program Files\Git\mingw64\libexec\git-core
git config --list
09:41:28.915183 exec_cmd.c:236 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-cor
e
09:41:28.917182 git.c:344 trace: built-in: git config --list
09:41:28.918181 run-command.c:640 trace: run_command: unset GIT_PAGER_IN_USE; LESS=FRX LV=-c less
core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
rebase.autosquash=true
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
http.sslbackend=openssl
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
credential.helper=manager
credential.modalprompt=false
credential.username=myGitUsername
当我git push
再次做时,我只需要第一次添加用户名和密码。
git push
Please enter your GitHub credentials for https://myGithubUsername@github.com/
username: myGithubUsername
password: *************
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 316 bytes | 316.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
自从使用以来git push
,我再也没有消息输入我的Git凭据。
D:\projects\react-redux\myProject (master -> origin) (budget@1.0.0)
λ git push
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 314 bytes | 314.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To https://github.com/myGitUsername/myProject.git
8d38b18..f442d74 master -> master
完成这些设置后,我也收到了一封电子邮件,其中包含以下消息:
A personal access token (git: https://myGitHubUsername@github.com/
on LAP0110 at 25-Jun-2018 09:22) with gist and repo scopes was recently added
to your account. Visit https://github.com/settings/tokens for more information.
我遇到了这个问题,并且只从以下位置删除了git-credential-manager.exe文件:
C:\Program Files\Git\mingw64\libexec\git-core
我想使用凭证管理器进行正常使用,但是我有一些脚本,其中我显然不希望来自的任何提示git.exe
。这是我从脚本中调用Git的方式:
set GIT_TERMINAL_PROMPT=0
git -c core.askpass= -c credential.helper= <command> ...
这样,脚本始终可以看到“正确的”无提示设置,而无需修改任何配置。
(适用于Windows 2.13.3的Git)
我发现也可以派上用场的一种变化是:
set GCM_INTERACTIVE=never
# Or: git config --global credential.interactive never
set GIT_TERMINAL_PROMPT=0
git.exe -c core.askpass= -c credential.helper=manager <command> ...
但要注意,git.exe -c credential.interactive=never <command> ...
确实不工作(似乎-c
事不通过路由到Git的凭据管理器的Windows或其他)。
这样,您可以使用GCMfW,但是它永远不会提示您;它只会查找凭据,这在非交互式环境中非常有帮助。
我在Ubuntu 18.10(Cosmic Cuttlefish)上遇到了相同的问题,无法使用任何常规方法将其删除。我用过git config --global --unset credential.helper
,那似乎可以解决问题。
为了防止使用对话框git config --global credential.modalPrompt false
,会将查询驱动到控制台。
您可以删除凭据管理器。
C:\Users\<USER>\AppData\Local\Programs\Git\mingw64\libexec\git-core