文章目录
一、 引言
1.1 编写目的
公司使用Git管理项目代码,SourceTree软件主要方便查看Git提交历史,及提交代码。本文主要记录SourceTree安装过程。
二、 安装与环境搭建
2.1 安装Git
2.1.1 Git安装包
1.1.2 Git安装步骤
参考安装步骤
路径
可以选择想要存放的地址,其他一直点击下一步
。
2.2 安装SourceTree
2.2.1 SourceTree安装包
2.2.2 SourceTree安装步骤
- 打开并运行下载的
SourceTreeSetup-3.4.3.exe
文件
注意:
Bitbucket服务器 和 Bitbucket 都需要账户登录,但打开需要外网连接
,故无法进行登录注册。 - 关闭
SourceTreeSetup-3.4.3.exe
, 在C:\Users\{yours}\AppData\Local\Atlassian\SourceTree
文件夹下创建accounts.json
文件。其中{yours}
是你的电脑用户名,举例:C:\Users\16354\AppData\Local\Atlassian\SourceTree。
若找不到AppData文件,点击文件资源管理器的查看,勾选隐藏的项目.
[
{
"$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": "username@email.com"
},
"IsDefault": false
}
]
- 重新打开
SourceTreeSetup-3.4.3.exe
,选择第一个下载一个只被SourceTree使用的内嵌版 Mercurial
4.进入 SourceTree
4. 添加 Git 用户
a. 使用SourceTree 添加账户
b. 通过VS添加用户
- 添加用户后,控制面板会显示刚添加的用户凭证。
- 成功克隆 Git 库,则安装成功!!!
三、克隆失败
3-1 failed error:403
【原因】:没有权限从远程库克隆该项目。
【解决方案】:添加 有权限的 Git 用户。
参考解决方案