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:声明:

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

  • 相关阅读:
    WinCC的电子签名与审计追踪 2.0
    如何在VB脚本中Ping IP
    如何在WinCC中管理Windows账户
    配置SQL Server维护计划-定时备份
    修改SQL Server中的计算机名
    WinCC的画面使用技巧
    用VB脚本复制文件夹并跳过重复文件
    如何在WinCC的VB脚本内实现延时功能
    用vbs和ADSI管理Windows账户
    oracle ROW_NUMBER() OVER(PARTITION BY '分组' ORDER BY '排序' DESC) 用法
  • 原文地址:https://www.cnblogs.com/yun6853992/p/9348484.html
Copyright © 2011-2022 走看看