zoukankan      html  css  js  c++  java
  • linux git push pull免账号密码

    linux

    在~/下, touch创建文件 .git-credentials, 用vim编辑此文件,输入内容格式:

    touch .git-credentials

    vim .git-credentials

    https://{username}:{password}@github.com


    2. 在终端下执行 git config --global credential.helper store
    3. 可以看到~/.gitconfig文件,会多了一项:
    [credential]

    helper = store

    windows

    1.方法一
    1.1 创建文件存储GIT用户名和密码

    在%HOME%目录中,一般为C:usersAdministrator,也可以是你自己创建的系统用户名目录,反正都在C:users中。文件名为.git-credentials,由于在Window中不允许直接创建以"."开头的文件,所以需要借助git bash进行,打开git bash客户端,进行%HOME%目录,然后用touch创建文件 .git-credentials, 用vim编辑此文件,输入内容格式:

    touch .git-credentials

    vim .git-credentials

    https://{username}:{password}@github.com

    1.2 添加Git Config 内容

    进入git bash终端, 输入如下命令:

    git config --global credential.helper store

    执行完后查看%HOME%目录下的.gitconfig文件,会多了一项:

    [credential]

    helper = store
    重新开启git bash会发现git push时不用再输入用户名和密码

    2.方法二
    2.1 添加环境变量

    在windows中添加一个HOME环境变量,变量名:HOME,变量值:%USERPROFILE%

    2.2 创建git用户名和密码存储文件

    进入%HOME%目录,新建一个名为"_netrc"的文件,文件中内容格式如下:

    machine {git account name}.github.com
    login your-usernmae
    password your-password
    重新打开git bash即可,无需再输入用户名和密码

  • 相关阅读:
    <爬虫实例> 8684公交网-太原公交线路信息
    <爬虫> requests模块
    爬虫四 selenium + phantomjs & Headless Chrome
    爬虫三 bs4&xpath&jsonpath
    爬虫二 cookie&正则
    爬虫一 发请求&定制请求&异常处理&配置代理
    抽屉页面设计
    HTML标签及其属性
    Python之路 day3 高阶函数
    Python之路 day3 递归函数
  • 原文地址:https://www.cnblogs.com/you-jia/p/5626301.html
Copyright © 2011-2022 走看看