zoukankan      html  css  js  c++  java
  • 解决向github提交代码每次都要求输入密码的问题(转)

     方法一:

      (其实就只需要一句话:git config --global credential.helper store)

    1. 在命令行输入命令:
      git config --global credential.helper store
      ☞ 这一步会在用户目录下的.gitconfig文件最后添加:
        [credential]
            helper = store
    
    1. 现在push你的代码 (git push), 这时会让你输入用户名密码, 这一步输入的用户名密码会被记住, 下次再push代码时就不用输入用户名密码啦!
      ☞这一步会在用户目录下生成文件.git-credential记录用户名密码的信息.
      git config --global 命令实际上在操作用户目录下的.gitconfig文件, 我们cat一下此文件(cat .gitconfig), 其内容如下:
    [user]
        name = alice
        email = alice@aol.com
    [push]
        default = simple
    [credential]
        helper = store
    

    git config --global user.email "alice@aol.com" 操作的就是上面的email
    git config --global push.default matching 操作的就是上面的push段中的default字段
    git config --global credential.helper store 操作的就是上面最后一行的值



    作者:元亨利贞o
    链接:https://www.jianshu.com/p/81ae6e77ff47
    來源:简书
    著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
    方法二:

    修改代码根目录的隐藏配置文件 " .git/config "文件

    [remote "origin"]
    url = https://username:passwd@github.com/dotheright/mylovelycodes.git
    fetch = +refs/heads/*:refs/remotes/origin/*

     

    username 改为你的用户名

    passwd 改为你的密码

    中间的冒号不能省略

    原理上讲其实就是URL的格式,里面可以带用户名密码.

     
  • 相关阅读:
    ReportViewer内存泄漏问题解决方案[上]
    升级到VS2012,reportViewer无法使用
    UE4C++定义属性修饰符总结
    UE4 多人网络对战游戏笔记
    UE4 C++ 笔记
    Unity添加多个可视镜头Preview功能(二)
    UE4 Creating 3D Widget Interaction
    UE4 Virtual Reality Input输入配置表导入
    Unity添加多个可视镜头Preview功能(一)
    设置电脑多久后自动关机
  • 原文地址:https://www.cnblogs.com/jaysonguo/p/8311012.html
Copyright © 2011-2022 走看看