zoukankan      html  css  js  c++  java
  • ubuntu使用git提交github时,执行pull或者push命令要重新输入用户名和密码

    ubuntu使用git提交github时,执行pull或者push命令要重新输入用户名和密码:

    1:问题现象:

    hlp@hlp:~/code/github_code/catch_imooc1$ git push
    Username for 'https://github.com': XXXX
    Password for 'https://XXXX@github.com': 
    Counting objects: 20, done.
    

     2:问题原因:

    使用git clone 克隆代码的时候默认使用了https的方式而不是ssh的方式。

    本地查看方式:
    hlp@hlp:~/code/github_code/catch_imooc1$ git remote -v
    origin	https://github.com/XXXX/xxx.git (fetch)
    origin	https://github.com/XXXX/xxx.git (push)
    

     3:修改方案:

    修改git clone 克隆代码方式为ssh的方式:

           1:获取ssh代码库地址,在github项目主页中,修改https地址方式为ssh方式

                  

      2:移除本地https获取方式,切换成ssh方式:

    修改https获取方式为ssh方式:
    hlp@hlp:~/code/github_code/catch_imooc1$ git remote rm origin
    
    查看本地代码库获取方式:
    hlp@hlp:~/code/github_code/catch_imooc1$ git remote -v
    
    修改本地代码库git获取地址为ssh方式:
    hlp@hlp:~/code/github_code/catch_imooc1$ git remote add origin git@github.com:XXXX/xxxx.git
    
    查看本地代码库获取方式:
    hlp@hlp:~/code/github_code/catch_imooc1$ git remote -v
    origin    git@github.com:XXXX/xxxx.git (fetch)
    origin    git@github.com:XXXX/xxxx.git (push)
    
    测试验证:
    hlp@hlp:~/code/github_code/catch_imooc1$ git push origin master
    Warning: Permanently added the RSA host key for IP address '13.250.177.223' to the list of known hosts.
    Everything up-to-date

    4:参考博文:

     https://www.cnblogs.com/sky6862/p/7992736.html

    5:声明:

        该博文只是为了规范自己的习惯,如有问题或者建议,请谅解。

  • 相关阅读:
    centos7 安装RabbitMQ
    idea 好用的java插件
    eureka 创建服务注册中心
    服务治理 1.注册中心知多少
    服务治理组件比较
    springboot 引入 fastDFS
    centos7 安装 fastDFS
    2、常用查询
    1-库表查看及常用数据类型
    报错:is not allowed to connect tothis mmysql server(mysql无法链接外网)
  • 原文地址:https://www.cnblogs.com/yun6853992/p/9348484.html
Copyright © 2011-2022 走看看