简体   繁体   English

无法使用git协议推送到git,起源是https?

[英]Can't push to git using git protocol, origin is https?

I just recently setup git-flow. 我最近才设置git-flow。 in the instructions I ran the following command: 在说明中,我运行了以下命令:

git config --global url."https://github".insteadOf git://github

and I don't think I needed to run that command. 而且我认为我不需要运行该命令。 I'm not sure if it is the cause but all of the sudden I cannot push a newly created git repo to it's origin. 我不确定这是否是原因,但是突然之间我无法将新创建的git repo推到它的来源。 my origin url that I added using git remote ad origin https://github.com/me/myrepo.git and as you can see it starts with https: but when I go to push it has changed to git:// as if it is using git:// instead of https:// 我使用git remote ad origin https://github.com/me/myrepo.git添加的原始URL,如您所见,它以https:开头,但是当我推送时,它已更改为git:// ,就像它使用git://而不是https://

So why would I get the message that I am trying to use git:// is there a configuration option or command I can run to ensure it uses https? 那么,为什么我会收到我尝试使用git://的消息,是否有可以运行以确保其使用https的配置选项或命令?

If you wish to use ssh (`git://') you have to create and upload ssh key to your github account. 如果您想使用ssh (`git://'),则必须创建ssh密钥并将其上传到您的github帐户。

  • Generate a new ssh key (or skip this step if you already have a key) 生成一个新的ssh密钥(如果已经有了密钥,则跳过此步骤)
    ssh-keygen -t rsa -C "your@email"

  • Once you have your key set in home/.ssh directory (or Users/<your user>.ssh under windows), open it and copy the content 将密钥设置到home/.ssh目录(或Windows下的Users/<your user>.ssh )后,将其打开并复制内容


How to add sh key to github account? 如何将sh键添加到github帐户?

  • Login to github account 登录到github帐户
  • Click on the rancher on the top right (Settings) 单击右上角的牧场主(设置)
    在此处输入图片说明
  • Click on the SSH keys 单击SSH keys
    在此处输入图片说明
  • Click on the Add ssh key 单击Add ssh key
    在此处输入图片说明
  • Paste your key and save 粘贴密钥并保存

And you all set to go :-) 你们所有人都去了:-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM