push到Github每次都要输入密码

来源:互联网 发布:mac 添加ttf字体 编辑:程序博客网 时间:2024/06/02 02:02

问题描述

push 到 Github 每次都要输入密码,原因是使用了 Https 的方式添加远程仓库

git remote add origin https://github.com/weiheli/UCenter.git

查看 push 和 fetch 方式

git remote -v // 输出origin  https://github.com/weiheli/UCenter.git (fetch)origin  https://github.com/weiheli/UCenter.git (push)

换成 ssh 方式

创建SSH Key,把id_rsa.pub中的内容添加到 Github 的Deploy keys

然后

git remote rm origingit remote add origin git@github.com:weiheli/UCenter.git

0 0