【问题标题】:gitbash (cache passphrase key): Can't get the ssh-agent to run on windows, modified the .bashrc & .profilegitbash(缓存密码密钥):无法让 ssh-agent 在 Windows 上运行,修改了 .bashrc 和 .profile
【发布时间】:2012-08-11 19:34:48
【问题描述】:

谁能帮忙,我在 Windows 上,git 正在使用我的源设置为 github。

当然,每次我希望拉/推或任何我需要为 github 提供密钥的密码时。

根据我阅读的内容,我需要编辑 ~/.profile 或 ~/.bashrc 并输入一些文本

见https://help.github.com/articles/working-with-ssh-key-passphrases

我已经这样做了很多次,我实际上在两个文件中都输入了它,但是当我打开一个新的 GitBash 窗口时,似乎什么都没有运行(我假设某些东西应该运行并根据上面的链接询问我的密码) .

当然,每次 Push 或 Pull 都会再次要求我输入密码。

我显然在这里遗漏了一些东西,有人可以帮忙吗?

记住我在 Windows 上 :-) 并使用 git for windows 附带的 gitbash。

提前致谢

【问题讨论】:

    标签: windows git github ssh-agent


    【解决方案1】:

    在 Windows 10 上这对我有用

    1. 运行 git bash
    2. touch ~/.profile
    3. start ~/.profile打开.profile
    4. 将以下内容添加到.profile
    #! /bin/bash 
    eval `ssh-agent -s` 
    ssh-add ~/.ssh/*_rsa
    

    这是基于this answer。唯一的区别是.bashrc 不起作用,而是.profile 起作用。

    【讨论】:

      【解决方案2】:

      经过大量调查,我发现了这个Remember Password, Git bash under windows

      它准确地解释了需要什么,它与它出现的 linux 不同。

      【讨论】:

        【解决方案3】:

        如果您通过“https”方法克隆了存储库,现在尝试以“ssh”方式或其他方式进行推送/拉取,则可能会发生这种情况。 看看这是否适合你:

        git remote set-url origin git@github.com:your_account/your_repo.git
        

        【讨论】:

        • 嗨,不,我没有克隆任何东西,它是一个 init,我像 SSH 一样输入了我的起源,但我不明白为什么脚本无论如何都不会运行,它与github 起源,当进入 bash shell(gitbash for win)时,脚本应该运行并向屏幕输出一些东西。
        • @Martin 尝试使用以下命令创建您的公钥/私钥对:ssh-keygen -t rsa -C "yourGithubMail" 然后将您的公钥添加到您的帐户中,看看是否可行。 (这样你指定 ssh 协议和 key 的类型)会做这里提到的事情:help.github.com/articles/generating-ssh-keys 希望有点帮助:)
        猜你喜欢
        • 1970-01-01
        • 2019-01-17
        • 2021-06-23
        • 2020-08-26
        • 2021-10-30
        • 2021-11-11
        • 2012-09-10
        • 2023-03-23
        相关资源
        最近更新 更多