zoukankan      html  css  js  c++  java
  • git命令设置

    初始化为git项目:

    cd .../project  //切换到项目目录下

    git init  //把project初始化为git项目

    git remote add origin https://gitee.com/name/project.git  //设置远程项目地址

    git remote set-url origin https://gitee.com/name/project.git  //修改远程项目地址

    首次把项目上传到git上。

    1.清空git上的项目。因为上面有个README.md文件

    2.使用上面的初始化为git项目命令后再上传

    //克隆远程项目到当前目录下:

    git clone https://gitee.com/name/project.git

    设置全局用户属性

    git config --global user.name "xxx"

    git config --global user.email "xxx@xx.com"

    设置局部项目用户属性,需要先切换到项目目录下 //如果没设置局部项目的用户属性则默认使用全局的用户属性

    git config user.name "xxx"

    git config user.email "xxx@xx.com"

    根据上面可以发现,设置全局则需要在config后增加 --global,设置局部项目则不需要加

    设置全局的git长期存储账号密码,如果不设置的话则每次与远程进行交互时都需要输入账号密码

    git config --global credential.helper store

    也可以设置账号密码有效时间(默认为15分钟)

    git config --global credential.helper cache

    自定义有效时间,设置有效时间为一小时
    git config --global credential.helper cache 'cache --timeout=3600'

  • 相关阅读:
    51Nod 1006 最长公共子序列Lcs
    输入和输出
    51Nod 1092 回文字符串
    51Nod 1050 循环数组最大子段和
    项目初始
    一元多项式求导 (25)
    说反话 (20)
    数组元素循环右移问题 (20)
    素数对猜想 (20)
    换个格式输出整数 (15)
  • 原文地址:https://www.cnblogs.com/Johnson-lin/p/9044491.html
Copyright © 2011-2022 走看看