Windows 将更改推送到Git不起作用

Windows 将更改推送到Git不起作用,windows,git,github,heroku,Windows,Git,Github,Heroku,每次我想要提交命令“git push heroku master”时,PowerShell都会要求我输入凭据。当我输入heroku凭据(默认情况下连接到git)时,我会收到错误消息 但是,当我在我的主目录中键入netrc文件中包含的credetials时,事情就正常了。然而,我认为密码是散列的。如何避免每次要将更改推送到git时都输入凭据 更新: PS C:\Users\Dragan\heroku_workspace\python-getting-started> git push her

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

但是,当我在我的主目录中键入netrc文件中包含的credetials时,事情就正常了。然而,我认为密码是散列的。如何避免每次要将更改推送到git时都输入凭据

更新:

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': my-email@hotmail.com
Password for 'https://my-email@hotmail.com@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远程设置url源git@github.com:username/repo.git

或者,如果您的存储库已经存在,请单击绿色按钮
克隆或下载
,然后选择使用
SSH

启用SSH身份验证
$heroku create--ssh-git

将HTTPS调用重定向到SSH
(如果您希望在特定机器上始终使用SSH Git和Heroku)
$git config——全局url。ssh://git@heroku.com/。而不是https://git.heroku.com/

要生成公钥,请执行以下操作:
ssh keygen-t rsa
在第一个提示下按enter键以使用默认文件位置。接下来,键入密钥的安全密码短语。

如果您使用的是v1.9.3或更高版本,则可以执行以下操作

git config --global credential.helper wincred
请注意,此机制将您的用户名/密码存储在Windows凭据存储中

在相对较新的版本中,默认情况下与绑定并启用,您可能必须覆盖Heroku的
credential.helper
配置。GCM似乎是为VSTS和GitHub设计的,我不知道它在其他服务器上的表现如何。

对我有用:

  • 使用windows命令提示符运行heroku登录
    cmd.exe
    。这将把您的API密钥放入
    \u netrc
    ,此时您可以打开cygwin或git bash并执行任何需要的操作

  • .gitconfig
    中删除
    helper=manager
    行,使其不再注册为凭证助手,并阻止其显示

    (在
    C:\Users\username\.gitconfig
    中)

  • 在Windows 7的用户目录中将_netrc文件重命名为.netrc:

    cd%home%

    REN\u netrc.netrc

  • 见:


    您收到的错误消息是什么?您只需执行一次heroku登录操作。@Harrison使用我的heroku凭证,即可使用comand heroku登录功能。但是,当我输入与以前相同的凭据时,comand git Push heroku master不会这样做。它只在我输入在netrc文件中找到的散列密码时才起作用,除此之外,每当我想做git推送时,我都必须这样做。。。错误消息在我更新的问题中的问题描述中。您能更具体一些吗?我到底需要在哪里从https切换到ssh?1。如果您进入github网站并
    登录
    2。转到您的存储库主页。3.然后在
    右侧
    您将看到一个
    绿色按钮
    ,上面写着
    克隆或下载
    单击itI我找到了可以从https切换到ssl的地方,但是,在这种情况下,git存储库是由heroku自动创建的,我不知道在哪里可以找到它。这是链接:您需要
    1创建ssh git
    ,然后
    2告诉heroku在您的计算机中使用ssh而不是hhtp
    ,您可能需要
    3创建一个密钥
    这是[密钥链接]()