Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Install git in google compute engine?

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?

like image 307
HaCos Avatar asked Dec 13 '14 16:12

HaCos


People also ask

How do I install Git on my machine?

To install Git, navigate to your command prompt shell and run the following command: sudo dnf install git-all . Once the command output has completed, you can verify the installation by typing: git version .

Can I use Git in cloud?

Google Cloud repositories are fully featured Git repositories. You can use the standard set of Git commands to interact with these repositories, including push , pull , clone , and log .


1 Answers

I actually have a similar setup. I installed Bitnami's Redmine VM on google cloud compute.

Most Bitnami VMs come with git installed, but not all. So try this:

Login to your Google Cloud Instance.

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.

Now, go to /opt/bitnami/apps/[app-name]/htdocs on your 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.

Hope this helps. Good luck.

like image 55
RebelOfBabylon Avatar answered Oct 05 '22 01:10

RebelOfBabylon