您当前的位置: 首页 >  服务器

暂无认证

  • 0浏览

    0关注

    92582博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

git之ssh与https地址之间的切换、设置免密码访问服务器、remote、set-url、config、global、credential、helper、store、cache、origin

发布时间:2022-06-08 22:07:08 ,浏览量:0

目录
  • 1、查看当前属于什么地址的命令
  • 2、从ssh切换至https
  • 3、从https切换至ssh
  • 4、设置密码
1、查看当前属于什么地址的命令
git remote -v

如果当前处于ssh状态下会输出一下内容。

origin  git@gitee.com:mssj200224/open-resources.git (fetch) origin  git@gitee.com:mssj200224/open-resources.git (push) 

如果当前处于https状态下会输出一下内容。

origin  https://git@gitee.com:mssj200224/open-resources.git (fetch) origin  https://git@gitee.com:mssj200224/open-resources.git (push) 
2、从ssh切换至https
git remote set-url origin https://git@gitee.com:mssj200224/open-resources.git

origin后面是远程仓库的https地址。

3、从https切换至ssh
git remote set-url origin git@gitee.com:mssj200224/open-resources.git

origin后面是远程仓库ssh地址。

4、设置密码

默认15分钟

git config --global credential.helper cache

自己定义时间,一小时后失效

git config credential.helper 'cache --timeout=3600' 

永久存储密码

git config --global credential.helper store
关注
打赏
1653961664
查看更多评论
立即登录/注册

微信扫码登录

0.5283s