1. 新建远程仓库后默认提交协议
2. 命令行输入
//增加 wincred 配置
$ git config --global credential.helper wincred
//如果需要删除 wincred 配置,执行下面语句
$ git config --global --unset credential.helper wincred
3. 执行后查看
$ vim ~/.gitconfig
设置成功之后,之后git push 提交时首次输入密码之后以后就不用输入密码可直接提交了
1. 创建SSH KEY 如果C盘用户目录下有没有.ssh目录,有的话看下里面有没有id_rsa和id_rsa.pub这两个文件,执行命令
$ ssh-keygen -t rsa -C "aaa@example.com"
其中aaa@example.com 为你的注册邮箱
2. 设置SSH Key
复制id_rsa.pub内容到
3. 切换克隆模式为SSH
4. 添加远程仓库
//关联远程仓库
$ git remote add origin git@github.com:username/test.git
// 克隆远程仓库
git clone git@github.com:username/test.git
3. 再次推送本地文件到远程仓库,可看到成功
$ git push -u p3c-master master
参考文献: https://blog.csdn.net/cn_1937/article/details/90714019 https://blog.csdn.net/DavidFFFFFF/article/details/88849419 https://www.cnblogs.com/7day/p/10966086.html https://www.liaoxuefeng.com/wiki/896043488029600/898732864121440