# SourceTree 在内网Windows下的安装与启用 - 运维手记 2018-11-26

> 作者：zning（https://ning.ae） · 发布：2018/11/26 21:19 下午 (UTC+8) · 原文：https://zning.me/15432383431936.html

今天工作有些东西需要整理，现在整理一下。

> 注意：本文首次撰写于2018-11-26，最近修改时间为2018-11-26，请注意相关程序的可用性与安全性。
    
SourceTree 是 Windows 和Mac OS X 下免费的 Git 和 Hg 客户端，拥有可视化界面，容易上手操作。同时它也是Mercurial和Subversion版本控制系统工具。支持创建、提交、clone、push、pull 和merge等操作。

我从官网上下载了信息的3.0.8版本，注册的时候发现需要进行注册。由于内网环境无法访问外网。想到是不是最新版本修复了这个漏洞，于是就下载了一个低版本：2.6.10.0。官方也提供了旧版本的下载地址：

https://www.sourcetreeapp.com/download-archives

下载后，安装完打开一次，在如下图这个页面之后关闭程序：

![](media/15432383431936/15432438964982.jpg)

打开我的电脑，在最上方的地址栏直接输入`%LocalAppData%\Atlassian\SourceTree\`这个路径，在此路径下新建`accounts.json`文件。输入如下内容：

```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
  }
]
```

再次打开 SourceTree 就可以直接跳过登录进入软件页面了。

## 参考文献

1. https://blog.csdn.net/fanshujuntuan/article/details/78077433
2. http://blog.51cto.com/putian/1287959
3. https://blog.csdn.net/maxsky/article/details/51171474
4. http://wiki.jikexueyuan.com/project/git-tutorial/remote-repository.html
5. http://www.luxinzhi.com/system/140.html
6. https://overtrue.me/articles/2015/05/install-latest-git-on-centos.html
7. https://blog.csdn.net/zsx157326/article/details/80059068
8. https://blog.csdn.net/chenqiai0/article/details/83472410
9. https://www.jianshu.com/p/3478e2a214a1
