• Windows下安装git


    Windows下安装git

    1. 下载git

    下载地址 https://git-scm.com/download/win
    当前最新版本 2.35.1

    2. 安装

    下载完成后双击安装文件,开始安装

    在select component环节

    勾选Simple context menu
    click next

    在Adjust your PATH environment环节

    勾选run git from windows command prompt
    click next

    在configuring the line ending conversions环节

    勾选checkout windows-style, commit unix-style line endings
    click next

    其他

    酌情修改安装选项然后点击下一步, 直到安装结束

    配置git

    配置author信息

    有两个选项必须配置, 一个是user.email, 一个是user.name
    这两选项是作为author信息填充到每一个commit中的,方便其他人联系作者

    git config --global user.email "your_email@example.com"
    git config --global user.name "your_name"
    

    配置ssh key

    如果还没有ssh key, 可以依照以下方法生成ssh key, 如果已有ssh key, 可以直接将ssh key中的公钥, 添加到github或gitlab的 ssh key配置中
    生产ssh key的方法如下
    打开Git Bash. 将如下命令中的email地址替换成你自己的email,

    ssh-keygen -t rsa -b 4096 -C "your_email@example.com"    
    

    当提升输入文件保存位置时 "Enter a file in which to save the key," 直接按回车, 文件将会保存到默认位置即user主目录的.ssh文件夹下

    Enter a file in which to save the key (/c/Users/you/.ssh/id_rsa):[Press enter] 
    

    当提升输入设置输入加密密码时,建议不要输入,如果为了追求更高的安全性, 可以输入密码。

    Enter passphrase (empty for no passphrase): [Type a passphrase]  
    Enter same passphrase again: [Type passphrase again] 
    

    完成以上动作后,系统将会在用户的home目录下的.ssh文件夹下生成一对ssh公钥和私钥, 复制公钥(~/.ssh/id_rsa.pub) , 添加到github或gitlab的ssh keys中,即可从github或gitlab代码仓库中,checkout代码了。

  • 相关阅读:
    TypeScript总结
    echarts超全超详情配置项
    《JavaScript高级程序设计》笔记
    ES6`…`扩展(spread)/收集(rest)运算符详解
    JavaScript深拷贝浅拷贝全析
    使用lodash.cloneDeep实现深拷贝
    MessageChannel
    JavaScript相等操作符(==)
    微信昵称emoji表情,特殊表情导致列表不显示,导出EXCEL报错等问题解决!
    SQL某个字段在原内容上增加固定内容或replace查找替换内容
  • 原文地址:https://www.cnblogs.com/guoapeng/p/16095262.html
Copyright © 2020-2023  润新知