Fork me on GitHub

github项目切换远程https到ssh通道

github 切换远程https到ssh通道

github 每个仓库有两类地址:https和ssh通道。

  1. https通道获取代码方便,提交过程中每次都需要输入用户名和密码。
  2. ssh通道需要提前配置号ssh-key的,后面clone的工程提交不需要输入用户和密码。

查看本地仓库对应的远程地址:

$ git remote -v
origin	https://github.com/horst3180/arc-theme (fetch)
origin	https://github.com/horst3180/arc-theme (push)

切换为ssh通道:

$ git remote set-url origin git@github.com:horst3180/arc-theme.git

$ git remote -v
origin	git@github.com:horst3180/arc-theme.git (fetch)
origin	git@github.com:horst3180/arc-theme.git (push)

提示:使用ssh通道需要搞定公钥配置。

添加ssh-key : https://help.github.com/articles/connecting-to-github-with-ssh/

posted @ 2017-02-13 10:59  龙城飞将军  阅读(1286)  评论(0编辑  收藏  举报