如何在谷歌计算引擎中安装 git?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27460923/
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
How to Install git in google compute engine?
提问by HaCos
I used bitnami stack to setup a new vm instance on Google compute engine.
The stack had prestashop preinstalled with it. I would like to pull prestahop code localy, make changes and push live.
Should i install git on the instance manually?
In google console there is an option to connect a repository with github repository, this only works for google engine, not for compute?
How can i install git or use any other service google provides for this instance and edit existing code?
我使用 bitnami stack 在 Google 计算引擎上设置了一个新的 vm 实例。该堆栈预装了 prestashop。我想在本地提取 prestahop 代码,进行更改并实时推送。
我应该在实例上手动安装 git 吗?
在 google 控制台中有一个选项可以将存储库与 github 存储库连接,这仅适用于 google 引擎,不适用于计算?我如何安装 git 或使用谷歌为此实例提供的任何其他服务并编辑现有代码?
回答by RebelOfBabylon
I actually have a similar setup. I installed Bitnami's Redmine VM on google cloud compute.
我实际上有类似的设置。我在谷歌云计算上安装了 Bitnami 的 Redmine VM。
Most Bitnami VMs come with git installed, but not all. So try this:
大多数 Bitnami VM 都安装了 git,但不是全部。所以试试这个:
Login to your Google Cloud Instance.
登录到您的 Google Cloud 实例。
then run (omitting the $
, of course):
然后运行($
当然省略):
$ which git
should display something like
应该显示类似的东西
/usr/bin/git
if not, run:
如果没有,请运行:
$ sudo apt-get update
Allow the update to run. Then run:
允许更新运行。然后运行:
$ sudo apt-get install git
Allow the install to run. Now running:
允许安装运行。现在运行:
$ which git
should return something like:
应该返回如下内容:
/usr/bin/git
Now, if you don't yet have a repository setup remotely go do that at www.github.com, www.bitbucket.com, or whatever service you use.
现在,如果您还没有远程设置存储库,请访问www.github.com、www.bitbucket.com或您使用的任何服务。
Now, go to /opt/bitnami/apps/[app-name]/htdocs
on your VM:
现在,转到/opt/bitnami/apps/[app-name]/htdocs
您的 VM:
$ cd /opt/bitnami/apps/[app-name]/htdocs
Then:
然后:
$ git init
$ git add .
$ git commit -m "initial commit"
$ git remote add origin <URL_TO_YOUR_REPO>
$ git push -u origin master
Now your instance files should be in your repo. You should now be able to clone and change locally, and pull changes on your Google Cloud VM.
现在您的实例文件应该在您的存储库中。您现在应该能够在本地克隆和更改,并在您的 Google Cloud 虚拟机上提取更改。
Hope this helps. Good luck.
希望这可以帮助。祝你好运。