如何使用 Google Cloud on Source Tree?
How use Google Cloud on Source Tree?
我刚刚在 Google Cloud 中创建了一个新的 Repo,并想使用 Source Tree 应用程序作为我的 git 交互的控制器。
但我一直被问到这个推送密码。
没有我的Google帐号密码我已经设置了二次验证密码,但仍然无法创建此密码。
编辑:
如果我尝试遵循本指南 Set Up a Google Cloud Git Repo In SourceTree
它说:
- https://console.developers.google.com
- 左面板>源代码>发布
- 点击第一段中的link"Configure your repository"
- 在第二句话中,单击带有 ?
的小帮助图标
- 点击link"generate your git credentials"
在步骤 2 上没有“来源 code/releases”选项
并且如果我尝试继续步骤 4“Git 凭据”,凭据中只有 API 凭据,而不是 Git。
推荐方式(使用 gcloud 凭据)
我找到了让它工作的解决方法 (macOS):
cd myproject
git config credential.helper gcloud.sh
您必须在本地 gcloud
CLI 中进行身份验证并将其保存在 $PATH
中。
然后通过终端启动SourceTree:
open /Applications/SourceTree.app/Contents/MacOS/SourceTree
这会将您的 $PATH
传播到 SourceTree 以使脚本 git-credentials-gcloud.sh
可用。
我设法找到了一个不涉及终端的解决方案。您应该在 SourceTree.app 包 (/Applications/SourceTree.app/Contents/Info.plist
) 的 Info.plist 中添加以下内容,在主要 <dict>
项目的末尾:
<?xml version="1.0" encoding="UTF-8"?>
<plist .....
<dict>
...
...
<key>LSEnvironment</key>
<dict>
<key>PATH</key><string>CONTENT OF YOUR $PATH</string>
</dict>
</dict>
然后你需要通过
刷新macOS缓存
- 将 SourceTree.app 重命名为 SourceTree2.app
- 将 SourceTree2.app 重命名为 SourceTree.app
大功告成,SourceTree 现在应该可以使用 gcloud 凭据了。
有密码:
如今,这样做很容易。
我在 Microsoft Windows 11 OS 机器上。
首先,按照以下说明在 Google 云 (gcloud) 存储库上创建存储库:
- https://cloud.google.com/source-repositories/docs/create-code-repository
- 将 Google 云上的远程存储库克隆到您的本地计算机(在该教程中解释了执行此操作的方法)
然后,安装 SourceTree,如果你没有的话。
在 SourceTree 上,导航到“添加”选项,以便浏览到本地计算机上刚刚克隆的存储库。
你准备好了!
您可以在 Google 云存储库上提交代码。
此致
我刚刚在 Google Cloud 中创建了一个新的 Repo,并想使用 Source Tree 应用程序作为我的 git 交互的控制器。
但我一直被问到这个推送密码。
没有我的Google帐号密码我已经设置了二次验证密码,但仍然无法创建此密码。
编辑: 如果我尝试遵循本指南 Set Up a Google Cloud Git Repo In SourceTree
它说:
- https://console.developers.google.com
- 左面板>源代码>发布
- 点击第一段中的link"Configure your repository"
- 在第二句话中,单击带有 ? 的小帮助图标
- 点击link"generate your git credentials"
在步骤 2 上没有“来源 code/releases”选项
并且如果我尝试继续步骤 4“Git 凭据”,凭据中只有 API 凭据,而不是 Git。
推荐方式(使用 gcloud 凭据)
我找到了让它工作的解决方法 (macOS):
cd myproject
git config credential.helper gcloud.sh
您必须在本地 gcloud
CLI 中进行身份验证并将其保存在 $PATH
中。
然后通过终端启动SourceTree:
open /Applications/SourceTree.app/Contents/MacOS/SourceTree
这会将您的 $PATH
传播到 SourceTree 以使脚本 git-credentials-gcloud.sh
可用。
我设法找到了一个不涉及终端的解决方案。您应该在 SourceTree.app 包 (/Applications/SourceTree.app/Contents/Info.plist
) 的 Info.plist 中添加以下内容,在主要 <dict>
项目的末尾:
<?xml version="1.0" encoding="UTF-8"?>
<plist .....
<dict>
...
...
<key>LSEnvironment</key>
<dict>
<key>PATH</key><string>CONTENT OF YOUR $PATH</string>
</dict>
</dict>
然后你需要通过
刷新macOS缓存- 将 SourceTree.app 重命名为 SourceTree2.app
- 将 SourceTree2.app 重命名为 SourceTree.app
大功告成,SourceTree 现在应该可以使用 gcloud 凭据了。
有密码:
如今,这样做很容易。 我在 Microsoft Windows 11 OS 机器上。
首先,按照以下说明在 Google 云 (gcloud) 存储库上创建存储库:
- https://cloud.google.com/source-repositories/docs/create-code-repository
- 将 Google 云上的远程存储库克隆到您的本地计算机(在该教程中解释了执行此操作的方法)
然后,安装 SourceTree,如果你没有的话。
在 SourceTree 上,导航到“添加”选项,以便浏览到本地计算机上刚刚克隆的存储库。
你准备好了! 您可以在 Google 云存储库上提交代码。
此致