git_安装

1 是什么?css

Git是一个免费的开源分布式版本控制系统,旨在快速高效地处理从小型到大型项目的全部事务。html

2 安装git

进入官网,针对本身的操做系统选择下载  https://git-scm.com/downloadsgithub

 

 因为外网下载速度很慢,因此选择找了一个连接下载https://pc.qq.com/detail/13/detail_22693.htmljson

 

 

 

 所有选择下一步,而后单击安装便可。app

 

点击鼠标右键,便可看到git的图形界面和命令行两个菜单。分布式

 

2 配置fetch

官网操做手册 https://git-scm.com/docs/git-config spa

配置用户名和邮箱操作系统

git config --global user.email "you@example.com"
git config --global user.name "Your Name"

3 命令的使用

可查看官方文档 https://git-scm.com/docs/git;用户手册https://git-scm.com/docs/user-manual.html

通常忘记命令,可以使用git xx --help或者git help xx来调用文档查看,例如 git add --help,即调出一个连接的页面。

  • 生成工做区   git init
  • 将文件放到暂存区  git add 文件名
  • 提交文件 git commit 文件名
  • 设置远程仓库的别名   git remote add 别名 https://github.com/axuezhonghua/test1.git
  • 提交到远程仓库   git push -u 别名 master   
  • 进行上面操做后第一次会跳出验证窗口进行验证

 

 进入github便可看到咱们提交的代码或者文件

 

 在github上直接修改该文件,而后在本地进行更新。

  • git fetch 拉取远程仓库的更新
  • git merge master 合并变动到本地master

 4 客户端

git自带的客户端界面不太好用,则用sourcetree  https://www.sourcetreeapp.com/

因为外网下载太慢选择https://pc.qq.com/search.html#!keyword=sourcetree该连接进行下载

 

 

 

 因为上面一步须要进行帐号登陆,可是咱们又打不开外网,因此须要逃过该步骤

在下面目录下新建一个accounts.json文件

输入如下内容

[
	  {
	    "$id": "1",
	    "$type": "SourceTree.Api.Host.Identity.Model.IdentityAccount, SourceTree.Api.Host.Identity",
	    "Authenticate": true,
	    "HostInstance": {
	      "$id": "2",
	      "$type": "SourceTree.Host.Atlassianaccount.AtlassianAccountInstance, SourceTree.Host.AtlassianAccount",
	      "Host": {
	        "$id": "3",
	        "$type": "SourceTree.Host.Atlassianaccount.AtlassianAccountHost, SourceTree.Host.AtlassianAccount",
	        "Id": "atlassian account"
	      },
	      "BaseUrl": "https://id.atlassian.com/"
	    },
	    "Credentials": {
	      "$id": "4",
	      "$type": "SourceTree.Model.BasicAuthCredentials, SourceTree.Api.Account",
	      "Username": "",
	      "Email": null
	    },
	    "IsDefault": false
	  }
	]

 

 从新点击可执行文件

 

相关文章
相关标签/搜索