【问题标题】:git remote url automatically resetsgit 远程 url 自动重置
【发布时间】:2016-03-03 18:37:38
【问题描述】:

我想使用 git-plus package 从 Atom 内部推送和拉取到我的 GitHub 存储库。

我正在使用 Windows 10。Git 在我的路径中。 Windows 客户端的 Github Desktop 工作正常。 Git Bash 也可以使用远程 https url。在使用 git-plus 的 Atom 中,我可以添加、提交、状态等。但是,当我尝试推送时,我一直得到这个 error(这本身并不重要)。可以说,Atom 需要 GitHub 身份验证才能使用 git-plus。

一些在线解决方案推荐使用 ssh(而不是 https),但上次我这样做时它完全破坏了 git。 (也许我做错了。)坚持使用 https,一些解决方案建议使用您的密码,如下所示:

https://{password}@github.com/user/repo.git

这根本不安全,所以我找到了一个临时解决方案来制作 OAuth 令牌并相应地设置给定存储库的远程 URL:

https://{token}@github.com/user/repo.git

这最初是可行的,但 远程 url 不断重置!

一些 repos 重置为 ssh (git@github.com/user/repo.git),一些 repos 重置为 https (https://github.com/user/repo.git)。它还必须为每个存储库手动设置,这让我觉得还有其他解决方案。

我的问题:

什么可能会重置远程 url?

我可以将 ssh 用于一些 repos 而不破坏其余部分吗?

是否有一些全局的、更永久的方式将 OAuth 令牌与 每个 远程存储库相关联?

我可以使用credential.helper 作为这个令牌吗?或者我可以使用credential.cache 作为我的 GitHub 密码,这样 Atom 中的 git-plus 仍然可以访问吗?

【问题讨论】:

    标签: git github ssh atom-editor


    【解决方案1】:

    您可以尝试将远程网址设置为:

    https://{user}@github.com/{user}/repo.git
    

    (将 {user} 替换为您的 GitHub 帐户用户名。)

    这将允许 git-plus 正确检测用户名,并要求您输入密码。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-08-07
      • 2018-08-29
      • 2021-12-31
      • 1970-01-01
      • 2013-05-11
      • 2012-09-11
      • 1970-01-01
      相关资源
      最近更新 更多