推送更改到 Git 不起作用

2024-05-23

每次我想要提交命令“git push heroku master”时,系统都会要求我在 PowerShell 中输入凭据。当我输入 heroku 凭据(默认情况下连接到 git)时,我收到错误消息。

但是,当我输入我的主目录中的 netrc 文件中包含的凭据时,该东西就会起作用。然而,在我看来,密码是经过哈希处理的。如何避免每次将更改推送到 git 时都输入凭据?

UPDATE:

PS C:\Users\Dragan\heroku_workspace\python-getting-started> git push heroku master
github --credentials get: github: command not found
Username for 'https://git.heroku.com': [email protected] /cdn-cgi/l/email-protection
Password for 'https://[email protected] /cdn-cgi/l/email-protection@git.heroku.com':
github --credentials erase: github: command not found
remote: !       WARNING:
remote: !       Do not authenticate with username and password using git.
remote: !       Run `heroku login` to update your credentials, then retry the git command.
remote: !       See documentation for details: Https://devcenter.heroku.com/articles/http-git#authentication
fatal: Authentication failed for 'https://git.heroku.com/mysterious-river-71834.git/'

一个常见的错误是使用默认 (HTTPS) 而不是 SSH 进行克隆。您可以通过转到存储库、单击 URL 字段左侧的 ssh 按钮并更新源远程的 URL 来纠正此问题,如下所示:
git remote set-url origin [email protected] /cdn-cgi/l/email-protection:username/repo.git

或者如果您的存储库已经存在,则单击绿色按钮CLONE OR DOWNLOAD并选择使用SSH

启用 SSH 身份验证

$ heroku create --ssh-git

将高 HTTPS 调用重定向到 SSH( If you want to always use SSH Git with Heroku on a particular machine)

$ git config --global url.ssh://[email protected] /cdn-cgi/l/email-protection/.insteadOf https://git.heroku.com/

生成公钥:

ssh-keygen -t rsa在第一个提示处按 Enter 键以使用默认文件位置。接下来,输入密钥的安全密码。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

推送更改到 Git 不起作用 的相关文章

随机推荐