git操作之ssh与https互换
2017-08-23 12:14
141 查看
git ssh 与 https 互换
我的情况是原本使用ssh,但是ssh突然使用不了,需要跟换https
步骤:
1)修改远程仓库地址
方法有三种:
1.修改命令
git remote set-url origin [url]
我这里使用 git remote set-url origin [url]命令,直接修改远程仓库为https的地址
2.先删后加
git remote rm origin
git remote add origin [url]
3.直接修改config文件
2)以上进行git操作的时候,每次都需要密码,所以可以配置免密
1)新建文件并保存密码
$ touch ~/.git-credentials
$ vim ~/.git-credentials
2)添加内容 https://{username}:{passwd}@github.com 3)添加git配置
$ git config --global credential.helper store
---------------------
如果想切回ssh,直接修改远程仓库的地址即可
例如:git remote set-url origin [ssh的url]
我的情况是原本使用ssh,但是ssh突然使用不了,需要跟换https
步骤:
1)修改远程仓库地址
方法有三种:
1.修改命令
git remote set-url origin [url]
我这里使用 git remote set-url origin [url]命令,直接修改远程仓库为https的地址
2.先删后加
git remote rm origin
git remote add origin [url]
3.直接修改config文件
2)以上进行git操作的时候,每次都需要密码,所以可以配置免密
1)新建文件并保存密码
$ touch ~/.git-credentials
$ vim ~/.git-credentials
2)添加内容 https://{username}:{passwd}@github.com 3)添加git配置
$ git config --global credential.helper store
---------------------
如果想切回ssh,直接修改远程仓库的地址即可
例如:git remote set-url origin [ssh的url]
相关文章推荐
- 解决git以 https和ssh方式 每次都要输入用户名和密码问题
- git 服务器中用户ssh-key的设置操作
- github上git clone中 https与ssh的区别
- Git使用手册:HTTPS和SSH方式的区别和使用
- 本地新建GitHub远程仓库SSH连接,git init 及 clone的操作记录
- Git:从ssh切换回https
- 通过ssh连接git操作
- GIT 由https切换到SSH
- Git_Git远程操作_第1课_ssh agent 管理 ssh key
- Git使用手册:HTTPS和SSH方式的区别和使用
- [Jenkins][Git]ssh原理以及与https的区别
- git使用ssh密钥和https两种认证方式汇总(转)
- 如何通过ssh的方式连接git及修复yosemite的git版本的https问题
- git SSH公钥和https请求
- github上git clone时ssh和https的
- Git之SSH与HTTPS免密码配置
- Git使用手册:HTTPS和SSH方式的区别和使用
- git config git ssh git https
- [Jenkins][Git]ssh原理以及与https的区别
- git https 转移到 ssh