简体   繁体   中英

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

I just recently setup 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. 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://

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?

If you wish to use ssh (`git://') you have to create and upload ssh key to your github account.

  • Generate a new ssh key (or skip this step if you already have a key)
    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


How to add sh key to github account?

  • Login to github account
  • Click on the rancher on the top right (Settings)
    在此处输入图片说明
  • Click on the SSH keys
    在此处输入图片说明
  • Click on the Add ssh key
    在此处输入图片说明
  • Paste your key and save

And you all set to go :-)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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