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的格式,里面可以带用户名密码.

     
  • 相关阅读:
    获取bootstrap table数据并封装 为json
    不自动切换eclipse视图
    over 分析函数之 lag() lead()
    oracle日期的处理
    表空间的创建
    分析函数 over用法 之row_number() runk_number
    oracle 序列
    Laravel 5
    使用hexo+github搭建免费个人博客详细教程
    windows7设置定时任务运行ThinkPHP框架程序
  • 原文地址:https://www.cnblogs.com/jaysonguo/p/8311012.html
Copyright © 2011-2022 走看看