有时我们clone项目时使用的是https协议,对于GitHub来说,push代码这时就需要用账号密码登录,不太方便
$ git remote -v
$ origin https://github.com/zhyee/Ranking-of-Internet-Corp-By-Go.git (fetch)
$ origin https://github.com/zhyee/Ranking-of-Internet-Corp-By-Go.git (push)
如果想修改成ssh协议可以使用如下命令
git remote set-url [–push] <name> <newurl> [<oldurl>]
例如
$ git remote set-url origin git@github.com:zhyee/Ranking-of-Internet-Corp-By-Go.git
$ git remote -v
$ origin git@github.com:zhyee/Ranking-of-Internet-Corp-By-Go.git (fetch)
$ origin git@github.com:zhyee/Ranking-of-Internet-Corp-By-Go.git (push)