git remote url自动重置

时间:2015-11-30 07:19:21

标签: git github ssh atom-editor

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

我正在使用Windows 10. Git在我的道路上。适用于Windows客户端的Github Desktop工作正常。 Git Bash也可以使用远程https网址。在使用git-plus的Atom中,我可以添加,提交,状态等。然而,当我尝试推送时,我不断得到这个error(这本身并不重要)。可以说Atom需要GitHub身份验证才能使用git-plus。

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

  

的https:// {密码} @ github.com /用户/ repo.git

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

  

的https:// {令牌} @ github.com /用户/ repo.git

这首先工作,但远程网址不断重置!

某些repos重置为ssh(bin/hbase clean --cleanZk ),有些重置为https(var obj = { "person1": { "name": "Bob", "last": "Smith" }, "person2": { "name": "John", "last": "Smith" }, "person3": { "name": "Jane", "last": "Smith" } } Object.keys(obj).forEach(function(v, k) { obj[v].no = k; }); console.log(obj);)。它还必须为每个存储库手动设置,这使我认为还有其他解决方案。

我的问题:

什么可以重置远程网址?

我可以将ssh用于某些回购而不用其他方法吗?

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

我可以使用git@github.com/user/repo.git作为此令牌吗?或者我可以使用https://github.com/user/repo.git作为我的GitHub密码,以便Atom中的git-plus仍然可以访问?

1 个答案:

答案 0 :(得分:0)

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

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

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

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