如何将与GitHub的连接从SSH更改为HTTPS? [英] How to change a connection to GitHub from SSH to HTTPS?
问题描述
昨天我在GitHub上创建了我的第一个存储库.建立连接时,我使用SSH而不是HTTPS,因此我经历了一些痛苦的SSH密钥创建和连接过程.有时我卡住了,连接失败了.我当时想知道如何恢复我开始的过程,而改用HTTPS连接开始.令人高兴的是,今天我通过SSH进行了连接,但是我想知道能够更改连接类型(SSH与HTTPS)的价值以及是否有办法做到这一点.
I created my first repository in GitHub yesterday. When making the connection I used SSH instead of HTTPS, so I went through a little painful SSH key creation and connection process. At some point I got stuck and the connection failed. I wondered at that moment how I could revert the process I started and begin with a HTTPS connection instead. Happily, today I got the connection working through SSH but I'm wondering about the value of being able to change the type of connection (SSH vs HTTPS) and if there is a way to do it.
推荐答案
假设您的遥控器称为 origin
,运行
Assuming your remote is called origin
, run
-
git远程设置URL来源https://...
-
git remote set-url --push origin https://...
您可以使用 git remote -v
查看已配置的遥控器,现在应该显示更新的URL.
You can view the configured remotes with git remote -v
, which should now show your updated URLs.
有关更多信息,请参见 git-remote
的文档详细信息.
See the documentation for git-remote
for more details.
这篇关于如何将与GitHub的连接从SSH更改为HTTPS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!