我使用生成的个人访问令牌将原始远程存储库克隆到本地存储库。现在我想将提交更改推送到我的远程存储库,git 要求输入密码。
我在这里搜索,找到了将我的原始 URL 从 SSH 设置为 HTTPS 的帮助;
git remote set-url origin https://<PERSONAL_ACCESS_TOKEN>@github.com/<Username>/<repo>.git
Run Code Online (Sandbox Code Playgroud)
git remote -v我使用现在的显示确认了更改
origin https://ghp_kGuXXXXXXXXXXXXXXXXXXXXXXX8dd@github.com/<correct_user>/<right_repo>.git (fetch)
origin https://ghp_kGuXXXXXXXXXXXXXXXXXXXXXXX8dd@github.com/<correct_user>/<right_repo>.git (push)
Run Code Online (Sandbox Code Playgroud)
尽管如此,当我尝试时git push仍然要求输入密码。请我需要帮助。我已经很沮丧了。如何在没有密码提示的情况下使用 PAT 推送到我的远程存储库。
如果您想通过 HTTPS 中的 URL 使用 PAT,您应该这样定义。
git remote set-url origin https://username:token@github.com/put_username_here/repo-name.git
Run Code Online (Sandbox Code Playgroud)
您缺少用户名。
| 归档时间: |
|
| 查看次数: |
7839 次 |
| 最近记录: |