Windows 上安装 git
一种方法是 git 官方版本下载地址 下载如下安装包:
安装之后会有好几个可执行程序 Git Bash、Git CMD、Git GUI,其中唯一堪大用的仅为 Git Bash,用法和 Ubuntu 的 bash 一模一样
还有一种方法是下载 GitHub for Windows,这是客户端版的 GitHub。目前还没用到。
Ubuntu 上安装 git
很简单的一行命令就搞定:
sudo apt-get install git1、查看 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=true2、配置 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.com4、新建一个 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



