我想在我的 mac 上 git 克隆一个具有两因素身份验证的私有存储库,我的 gitlab 中已经有一个个人访问令牌,并且我正在尝试找到在 vscode 终端上运行的正确命令。
omarfuentes@192 ~ % git 克隆https://gitlab.com/OmarLeonardo/frappe/proyectos/frappe-oms/frappe-server.git?personal_access_token=myaccesstoken https://gitlab.com/OmarLeonardo/frappe/proyectos/frappe-oms/frappe-server.git?personal_access_token=myaccesstoken
然而答案是:
zsh:未找到匹配项:https://gitlab.com/OmarLeonardo/frappe/proyectos/frappe-oms/frappe-server.git?personal_access_token=myaccesstoken https://gitlab.com/OmarLeonardo/frappe/proyectos/frappe-oms/frappe-server.git?personal_access_token=myaccesstoken
如果您使用 PAT(个人访问令牌)正确的范围 https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#personal-access-token-scopes,你应该使用:
git clone https://<my-user-id>:<my-token>@gitlab.com/<my-account>/<my-project-name>.git
# or
git clone https://oauth2:<my-token>@gitlab.com/<my-account>/<my-project-name>.git
这将避免需要对参数进行 URL 编码。
但为了避免直接在远程 URL 中暴露令牌,请考虑使用凭证存储 https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)