git操作之ssh与https互换

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]
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值