git - (GCMC - windows) git credential manager core 不断提示输入密码 (gitlab repo)
问题描述
更改我的 gitlab 帐户密码后,我在设置凭证助手时遇到了麻烦。我卸载了我以前的 git for windows 版本并安装了最新的版本,包括 Git Credential Manager Core。
我正在使用 Android Studio 并设法通过 IDE 获取/拉取/推送。由于我为 Windows 安装了这个新版本的 git,所以不时出现提示。更糟糕的是,有时当我执行 git 操作时,我的帐户由于公司政策而被阻止(我猜是在多次调用错误密码之后)。
我试图将我的凭证助手设置为manager
,manager-core
但没有运气。我曾经在 Windows 身份验证管理器中添加条目,但它们被从中删除,不知道是谁。
我的远程仓库设置了 https URL。
所以我的问题是:如何设置 GCMC 在我的密码过期时询问我的密码并缓存我提供的新密码?
我对 GCMC 有点不满,但找不到答案,这太疯狂了,新东西实际上比今天弃用的旧工具更复杂和错误(例如,与 wincred 一起工作得很好)。
解决方案
我最终使用了访问令牌。我做了一个小文档(法语,对不起)。
语境
Depuis la version v2.29.0 , git for windows préconise l'utilisation de GCMC - Git Credential Manager Core -
en remplacement de "Git Credential Manager" (deprecated):
重要提示:v2.29.0 和 v2.29.1 将 Git Credential Manager for Windows(刚刚弃用)的现有用户升级到 Git Credential Manager Core(“GCM Core”,它是前者的指定继任者)。这是必要的,因为 GitHub 已弃用基于密码的身份验证,并打算很快取消对它的支持,而 GCM Core 已为这一变化做好准备。”
安装
- Dans les étapes d'installation de git for Windows, sélectionner
Git Credential Manager Core
配置
- Une fois l'installation effectuée, ouvrir un bash git et valider que la commande
git config credential.helper
retourne bienmanager-core
- Se rendre dans le gestionnaire d'identification Windows et supprimer les éventuelles entrées existantes vers
git:https://git.xxxx
- Dans les settings gitlab, générer un access token (name :
personal access token
) - Dans le répertoire d'un projet clôné depuis git, réaliser un
git pull / fetch / push
- Une modale s'ouvre, renseigner alors en login :
personal access token
, password :le token nouvellement créé
- Valider l'ajout de la nouvelle entrée dans le gestionnaire d'identification Windows avec comme login
personal access token
- Si votre IDE (testé avec IntelliJ / Android Studio) 要求 une authentification, cocher
Use credential manager
调试
En cas de problème et pour activer le debug ouvrir une invite de commande et taper :
setx GIT_TRACE %userprofile%\git.log
setx GCM_TRACE %userprofile%\git.log
setx GCM_TRACE_SECRETS 1 (attention, des informations sensibles seront visibles dans le log - access token -)
Après 通过 git bash / IDE un fichier git.log
devrait donc être présent dans votre répertoire %userprofile% (ce n'est pas instantané) 使用
日志外:
[RunAsync] Tracing of secrets is enabled. Trace output may contain sensitive information.
[RunInternalAsync] Git Credential Manager version X (Windows, .NET Framework X) 'store'
[ExecuteAsync] Start 'store' command...
[ExecuteAsync] Detecting host provider for input:
[ExecuteAsync] protocol=https
[ExecuteAsync] host=git.xxxx
[ExecuteAsync] username=personal access token
[ExecuteAsync] password=XXXXXXXXXXXXXXXXXXXXX <-------- votre access token
[GetProvider] Performing auto-detection of host provider.
[ExecuteAsync] Host provider 'Generic' was selected.
[StoreCredentialAsync] Storing credential with service=https://git.xxxx account=personal access token...
[StoreCredentialAsync] Credential was successfully stored.
[ExecuteAsync] End 'store' command...
Pour désactiver le debug : supprimer les variables d'environnement GIT_TRACE
, GCM_TRACE
,GCM_TRACE_SECRETS
推荐阅读
- c++ - 初始化派生结构的基础部分/意外打包派生结构字段到基础结构的对齐间隙
- php - 在 mySQL 中查询以随机顺序从每个“目的”11 中选择 44 个问题 PHP/Laravel
- amazon-web-services - CodePipeline 错误:类 java.lang.Boolean 无法转换为字符串
- java - 快速排序未在运行中实施?
- performance - 方案:为什么内部定义比外部定义快?
- java - 为什么 JAVA 中的 InputStream 忽略中断
- javascript - 使用下划线减少基于数组的对象项
- c++ - 在 C++ 类中初始化/创建向量
- c# - 如何在 File.WriteAllLines 文件名中设置变量?
- java - 将图像从 Java TCP 客户端发送到 Node.js TCP 服务器