windows 在没有 Atlassian 帐户的情况下安装 SourceTree?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/41385705/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 19:46:49  来源:igfitidea点击:

Install SourceTree without an Atlassian account?

windowsgitatlassian-sourcetreesourcetree

提问by MikeTheTall

I'm trying to use SourceTree for a class that I'm teaching. In order to do that we need to install SourceTree onto the school's Windows computers.

我正在尝试将 SourceTree 用于我正在教授的课程。为此,我们需要将 SourceTree 安装到学校的 Windows 计算机上。

When we try to install SourceTree (Version 1.9.10.0) it demands an Atlassian account before it will start. Obviously this is wrong - since we're trying to install SourceTree onto a shared computer (into a VM, to be specific) we don't have just one account (and, on top of that, we're using SourceTree with GitLab, not BitBucket/Atlassian, so we don't need their account anyways).

当我们尝试安装 SourceTree(版本 1.9.10.0)时,它需要一个 Atlassian 帐户才能启动。显然这是错误的 - 因为我们试图将 SourceTree 安装到一台共享计算机上(具体来说,安装到一个 VM 中)我们没有只有一个帐户(而且,最重要的是,我们将 SourceTree 与 GitLab 一起使用,不是 BitBucket/Atlassian,所以我们不需要他们的帐户)。

Is it possible to install SourceTree but skip the 'create an Atlassian account' step during the install process?

是否可以安装 SourceTree 但在安装过程中跳过“创建 Atlassian 帐户”步骤?

(We'd be ok with having the students create accounts later on, when they first start using it - we just don't want all the students to share a single BitBucket account by default)

(我们可以让学生稍后创建帐户,当他们第一次开始使用它时 - 我们只是不希望所有学生默认共享一个 BitBucket 帐户)

采纳答案by pedrorijo91

I don't think SourceTree allows to install without using an Atlassian Account. I've also tried and couldn't make it.

我认为 SourceTree 不允许在不使用 Atlassian 帐户的情况下进行安装。我也试过了,还是不行。

Have a look at Github Desktop, I think it allows not to configure an account https://desktop.github.com/

看看 Github Desktop,我认为它允许不配置帐户https://desktop.github.com/

(I also prefer the UI from what I've seen - CLI still rules)

(我也更喜欢我所看到的 UI - CLI 仍然是规则)

Edit:keep in mind that's easier for the students to google by themselves solutions to problems with git using the CLI than using UI apps

编辑:请记住,使用 CLI 比使用 UI 应用程序更容易让学生自己搜索 git 问题的解决方案

回答by ws_

Yes it is quite possible.

是的,这是很有可能的。

  1. Uninstallthe standard sourcetree version before step 2
  2. Use Sourcetree for Windows Enterpriseversion with this json hack (thanks @wow qing 's comment)
  3. Create a file %LocalAppData%\Atlassian\SourceTree\accounts.jsonand put the following data in it:
  1. 在第 2 步之前卸载标准 sourcetree 版本
  2. 将此 json hack用于 Windows Enterprise版本的 Sourcetree(感谢 @wow qing 的评论)
  3. 创建一个文件%LocalAppData%\Atlassian\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 }

{ "$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 }

  1. Manually call it from e.g. C:\Program Files\Attlassian\SourceTree\Sourcetree.exe (because in my case there was no shortcut created.)
  1. 从例如 C:\Program Files\Attlassian\SourceTree\Sourcetree.exe 手动调用它(因为在我的情况下没有创建快捷方式。)

updated, it works with 3.1.2 version

已更新,适用于 3.1.2 版本

[
  {
    "$id": "19",
    "$type": "SourceTree.Api.Host.Identity.Model.IdentityAccount, SourceTree.Api.Host.Identity",
    "IsDefault": false,
    "Authenticate": true,
    "HostInstance": {
      "$id": "20",
      "$type": "SourceTree.Host.Bitbucket.BitbucketInstance, SourceTree.Host.Bitbucket",
      "Host": {
        "$id": "21",
        "$type": "SourceTree.Host.Bitbucket.BitbucketHost, SourceTree.Host.Bitbucket",
        "Id": "bitbucket"
      },
      "BaseUrl": "https://bitbucket.org/",
      "Protocol": "HTTPS"
    },
    "Credentials": {
      "$id": "22",
      "$type": "SourceTree.Api.Account.OAuth.TwoZero.OAuthTwoZeroCredentials, SourceTree.Api.Account.OAuth.TwoZero",
      "AuthenticationScheme": {
        "$type": "SourceTree.Api.Account.OAuth.TwoZero.OAuthTwoZeroBearerAuthenticationScheme, SourceTree.Api.Account.OAuth.TwoZero",
        "Name": "OAuth",
        "Description": "OAuth",
        "HeaderValuePrefix": "Bearer",
        "UsernameIsRequired": false
      },
      "Id": "",
      "Username": "",
      "DisplayName": null,
      "Email": "",
      "AvatarURL": null,
      "EmailHash": ""
    }
  }
]

回答by stormwild

Thanks to Mikefor mentioning the version of SourceTree that did not require a login.

感谢Mike提到不需要登录的 SourceTree 版本。

It's possible to install SourceTree v1.6.4 which does not require a login to an Atlassian acount.

可以安装不需要登录到 Atlassian 帐户的 SourceTree v1.6.4。

How to install SourceTree v1.6.4 for Windows

如何为 Windows 安装 SourceTree v1.6.4

How to install SourceTree v1.6.4 for Windows

如何为 Windows 安装 SourceTree v1.6.4

This gist shows how to install SourceTree without having to login to an Atlassian account.

这个要点展示了如何在无需登录 Atlassian 帐户的情况下安装 SourceTree。

Later versions of SourceTree after v1.6.4 require a login to an Atlassian account.

v1.6.4 之后的 SourceTree 更高版本需要登录到 Atlassian 帐户。

Steps:

脚步:

  • Install Chocolatey
  • Install SourceTree 1.6.4 using Chocolatey
  • 安装巧克力
  • 使用 Chocolatey 安装 SourceTree 1.6.4

Install Chocolatey

安装巧克力

  • Run Windows Powershell as Administrator
  • Run the following command Set-ExecutionPolicy Bypass; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
  • 以管理员身份运行 Windows Powershell
  • 运行以下命令 Set-ExecutionPolicy Bypass; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

Install SourceTree Using Chocolatey

使用 Chocolatey 安装 SourceTree

Run the following command within an administrative console/terminal/powershell.

在管理控制台/终端/powershell 中运行以下命令。

choco install sourcetree --version 1.6.4

choco install sourcetree --version 1.6.4

References

参考

回答by Mike

Can confirm that SourceTree V 1.6.14.0 does NOT require an account... so this is why I hit never update for an old version on my other computer ;)

可以确认 SourceTree V 1.6.14.0 不需要帐户......所以这就是为什么我在另一台计算机上点击永不更新旧版本的原因;)

I am not 100% sure if that is the latest version that still has this feature, but works for my purposes.

我不是 100% 确定那是否是仍然具有此功能的最新版本,但对我的目的有效。

回答by yike8

https://github.com/yike8/sourcetree-skip-bitbucket-registration

https://github.com/yike8/sourcetree-skip-bitbucket-registration

How to skip bitbucket registration when installing sourcetree?

安装sourcetree时如何跳过bitbucket注册?

The first step is to run SourceTreeSetup-3.1.3.exe and close it after popping up the registration interface.

第一步,运行SourceTreeSetup-3.1.3.exe,弹出注册界面后关闭。

The second step is to open the %LocalAppData%\Atlassian directory, find accounts.json and user.config, and replace them with the files I provided.

第二步,打开%LocalAppData%\Atlassian目录,找到accounts.json和user.config,替换成我提供的文件。

e.g.

例如

%LocalAppData%\Atlassian\SourceTree\accounts.json

%LocalAppData%\Atlassian\SourceTree\accounts.json

%LocalAppData%\Atlassian\SourceTree.exe_Url_iayhtc13zv3obzuz5vchezjs1az2q5ef\3.1.3.3158\user.config

%LocalAppData%\Atlassian\SourceTree.exe_Url_iayhtc13zv3obzuz5vchezjs1az2q5ef\3.1.3.3158\user.config

回答by Michael Ozeryansky

I just discovered you need an account to access the app, but you can logout and still be able to use the app.

我刚刚发现您需要一个帐户才能访问该应用程序,但您可以注销并仍然能够使用该应用程序。

回答by Gomathi Nayagam

You can create a temp account by using a temp email. Then you can delete the account once its installed and use your own corporation git ids. It is the easiest way.

您可以使用临时电子邮件创建临时帐户。然后,您可以在安装后删除该帐户并使用您自己的公司 git id。这是最简单的方法。

回答by tobster

I managed to avoid registration with the current version as of today, which is 3.3.8.

我设法避免注册到今天的当前版本,即 3.3.8。

All you need is yet an already mentioned 'accounts.json' placed in %AppData%\Atlassian\SourceTree\accounts.json (look carefully, it's now %Appdata% not %Local...%)

你所需要的只是一个已经提到的 'accounts.json' 放在 %AppData%\Atlassian\SourceTree\accounts.json (仔细看,现在是 %Appdata% 而不是 %Local...%)

The file I used prepares a GitHub account with OAuth (you will need to apply some fresh OAuth from the edit accounts dialog). You can also delete that account and do what you like.

我使用的文件准备了一个带有 OAuth 的 GitHub 帐户(您需要从编辑帐户对话框中应用一些新的 OAuth)。您也可以删除该帐户并做您喜欢的事情。

[
  {
    "$id": "41",
    "$type": "SourceTree.Model.ScmAccount, SourceTree.Api.Host.Scm",
    "IsDefault": false,
    "Authenticate": true,
    "HostInstance": {
      "$id": "42",
      "$type": "SourceTree.Host.GitHub.GitHubInstance, SourceTree.Host.GitHub",
      "Host": {
        "$id": "43",
        "$type": "SourceTree.Host.GitHub.GitHubHost, SourceTree.Host.GitHub",
        "Id": "github"
      },
      "BaseUrl": "https://github.com/",
      "Protocol": "HTTPS"
    },
    "Credentials": {
      "$id": "44",
      "$type": "SourceTree.Api.Account.OAuth.TwoZero.OAuthTwoZeroCredentials, SourceTree.Api.Account.OAuth.TwoZero",
      "AuthenticationScheme": {
        "$type": "SourceTree.Api.Account.OAuth.TwoZero.OAuthTwoZeroBearerAuthenticationScheme, SourceTree.Api.Account.OAuth.TwoZero",
        "Name": "OAuth",
        "Description": "OAuth Token",
        "HeaderValuePrefix": "Bearer",
        "UsernameIsRequired": false
      },
      "Id": null,
      "Username": "github-username",
      "DisplayName": "Your Name",
      "Email": null,
      "AvatarURL": "https://cdn3.iconfinder.com/data/icons/inficons/128/stackoverflow.png",
      "EmailHash": null
    }
  },
  {
    "$id": "18",
    "$type": "SourceTree.Api.Host.Identity.Model.IdentityAccount, SourceTree.Api.Host.Identity",
    "IsDefault": false,
    "Authenticate": true,
    "HostInstance": {
      "$ref": "42"
    },
    "Credentials": {
      "$ref": "44"
    }
  }
]

回答by Pawel

2020 updateNo admin, no installation, no registration

2020 更新无需管理员、无需安装、无需注册

Here's a script that downloads version 3.3.8, unpacks MSI and copies config files to %APPDATA% to skip registration

这是一个下载 3.3.8 版本、解压 MSI 并将配置文件复制到 %APPDATA% 以跳过注册的脚本

https://github.com/DVLP/sourcetree-portable-bypass-registration

https://github.com/DVLP/sourcetree-portable-bypass-registration

Download as ZIP, in powershell run sourcetree_portable.ps1

下载为 ZIP,在 powershell 中运行 sourcetree_portable.ps1

$version="3.3.8"
$url="https://product-downloads.atlassian.com/software/sourcetree/windows/ga/SourcetreeEnterpriseSetup_$($version).msi"
$client = New-Object System.Net.WebClient

echo "Downloading sourcetree"
$client.DownloadFile($url, (Get-Item -Path ".\").FullName + "\sourcetree.msi")
mkdir sourcetree
$msi = (Get-ChildItem "*.msi" | select  -Last 1).fullname
$target = (Get-Item -Path ".\sourcetree").FullName

echo ""
echo "Unpacking..."
msiexec /a $msi /qb TARGETDIR=$target
Start-Sleep -s 5

echo "Opening and closing SourceTree.exe to create default directories..."
$exe = (Get-ChildItem -Recurse "./SourceTree.exe" | select  -Last 1).fullname
& $exe
Start-Sleep -s 5
echo "Waiting 10s. Don't close SourceTree, it will close itself."
Start-Sleep -s 10

echo "Killing SourceTree"
kill (Get-Process SourceTree).id

echo "Finding installation directories"

$userConfPath=(Get-ChildItem -LiteralPath $env:LOCALAPPDATA\Atlassian -Recurse -Directory -Filter $version* -Force).fullname

echo "Copying config files (sign-in bypass)"
Copy-Item ".\user.config" -Destination $userConfPath
Copy-Item ".\accounts.json" -Destination $env:APPDATA\Atlassian\SourceTree

echo "Flattening folder"
Get-ChildItem -Path .\sourcetree\ProgramFiles\Atlassian\Sourcetree -Recurse | Move-Item -Destination .\sourcetree
# Start-Sleep -s 2

echo "Cleaning up"
rm $msi
rm .\sourcetree\sourcetree.msi
rm -Recurse .\sourcetree\ProgramFiles

Read-Host -Prompt "Press Enter to exit"