栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

git命令行极简使用手册

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

git命令行极简使用手册

0、安装 git

Windows 上安装 git
一种方法是 git 官方版本下载地址 下载如下安装包:

安装之后会有好几个可执行程序 Git Bash、Git CMD、Git GUI,其中唯一堪大用的仅为 Git Bash,用法和 Ubuntu 的 bash 一模一样

还有一种方法是下载 GitHub for Windows,这是客户端版的 GitHub。目前还没用到。

Ubuntu 上安装 git
很简单的一行命令就搞定:

sudo  apt-get  install  git
1、查看 git 配置
git config --list

diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
http.sslbackend=openssl
http.sslcainfo=D:/software/Git/mingw64/ssl/certs/ca-bundle.crt
core.autocrlf=true
core.fscache=true
core.symlinks=false
pull.rebase=false
credential.helper=manager-core
credential.https://dev.azure.com.usehttppath=true
init.defaultbranch=master
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
user.name=Yachao Jia                                //提交必备1/2
user.email=123456789@qq.com                         //提交必备2/2
core.editor=nano                                    //默认编辑器
usr.name=Yachao Jia                                 //配置用户名的时候敲错了user,还不知道怎么删误写的配置
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
2、配置 git 默认编辑器
git  config  --global  core.editor  nano             //将默认编辑器设置为nano
git  config  --global  user.name  "Yachao Jia"       //配置提交用户名
git  config  --global  user.email  123456789@qq.com  //配置提交邮箱
3、查看 git 某一项配置
git  config  core.editor    //查看编辑器
nano

git  config  user.name      //查看用户名
Yachao Jia

git  config  user.email     //查看用户邮箱
123456789@qq.com
4、新建一个 git 仓库

①新建一个文件夹,给文件夹起上合适的名字
②进入该文件夹执行如下命令:

git  init       //有点类似 ROS 初始化工作空间,会在当前目录生成一个 .git 的隐藏文
                //件夹,有 .git 文件夹就说明了本工作空间是一个 git 工程的文件夹
5、克隆现有的 git 仓库
git  clone  [URL]                                             //克隆的命令行格式
git  clone  https://github.com/libgit2/libgit2                //这行笔者这里会报 time out 的错误
git  clone  https://gitclone.com/github.com/libgit2/libgit2   //解决上一行访问gitHub出 time out 的问题

感谢这位网友分享的解决办法:Wang CVer

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/884939.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号