[英]How use Google Cloud on Source Tree?
I just created a new Repo in Google Cloud and wanna use the Source Tree app as controllers for my git interactions.我刚刚在 Google Cloud 中创建了一个新的 Repo,并想使用 Source Tree 应用程序作为我的 git 交互的控制器。
But I keep been asked this password for push.但我一直被问到这个推送密码。
Is no my Google account password I already setup the 2-verification password, but still not able to create this password.没有我的谷歌帐户密码 我已经设置了二次验证密码,但仍然无法创建此密码。
EDIT: If I try to follow this guide Set Up a Google Cloud Git Repo In SourceTree编辑:如果我尝试按照本指南设置 Google Cloud Git Repo In SourceTree
It says:它说:
On Step 2 there is no " source code/releases " option在第 2 步中没有“源代码/发布”选项
And If I try to go on Step 4 " Git Credentials ", in credentials only have API Credentials, not Git.如果我在第 4 步尝试 go“ Git 凭据”,凭据中只有 API 凭据,而不是 Git。
Recomended way (with gcloud credentials) 推荐方式(使用gcloud凭证)
I found a workaround to get it work (macOS): 我找到了一个解决方法来实现它(macOS):
cd myproject git config credential.helper gcloud.sh
You must be authenticated in your local gcloud
CLI and have it in your $PATH
.您必须在本地 gcloud
CLI中进行身份验证,并将其保存在$PATH
。Then start SourceTree through the Terminal: 然后通过终端启动SourceTree:
open /Applications/SourceTree.app/Contents/MacOS/SourceTree
This will propagate your $PATH
to SourceTree in order to make the script git-credentials-gcloud.sh
available.这会将 $PATH
传播到SourceTree,以使脚本git-credentials-gcloud.sh
可用。
I managed to find a solution that does not involved the Terminal. 我设法找到了一个不涉及终端的解决方案。 You should add the following in the Info.plist of the SourceTree.app package ( /Applications/SourceTree.app/Contents/Info.plist
), at the end of the main <dict>
item: 您应该在主<dict>
项的末尾的SourceTree.app包的Info.plist中添加以下内容( /Applications/SourceTree.app/Contents/Info.plist
):
<?xml version="1.0" encoding="UTF-8"?> <plist ..... <dict> ... ... <key>LSEnvironment</key> <dict> <key>PATH</key><string>CONTENT OF YOUR $PATH</string> </dict> </dict>
Then you need to flush the macOS cache by 然后你需要刷新macOS缓存
You are done, SourceTree should now be able to use the gcloud credentials. 您已完成,SourceTree现在应该能够使用gcloud凭据。
With password : 使用密码 :
Browse https://source.developers.google.com/auth/start?scopes=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform 浏览https://source.developers.google.com/auth/start?scopes=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform
Nowadays, it's easy to do so.如今,这样做很容易。 I am on Microsoft Windows 11 OS machine.我在 Microsoft Windows 11 OS 机器上。
Firstly, follow these instructions on creating a repository on Google Cloud (gcloud) Repositories:首先,按照以下说明在 Google Cloud (gcloud) Repositories 上创建存储库:
Then, install the SourceTree, if you do not have one.然后,安装 SourceTree,如果你没有的话。
On SourceTree, navigate to the "Add" option, in order to browse to just cloned repository on your local machine.在 SourceTree 上,导航到“添加”选项,以便浏览到本地计算机上刚刚克隆的存储库。
And you are ready to go. You can commit the code on your Google Cloud Repositories.您已准备好拨打 go。您可以在 Google 云存储库上提交代码。
Best regards最好的祝福
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.