push" from a local computer to an instance of Google Cloud Platform? The documentation for the Google Cloud Platform describes se...">

How to "w20> push" from a local computer to an instance of Google Cloud Platform?

The documentation for the Google Cloud Platform describes several ways to transfer files to instances of the Google Compute Engine. But it does not mention how to use Git for this. In addition, although I have Google Cloud code repositories available in the Development section of the web console, it’s not clear to him how to link them to Compute instances.

How do I link a Git repository to an instance of Google Compute Engine and git pushfrom my local computer to an instance of repo?

+4
source share
2 answers

SSH GCE Linux , :

  • gcloud auth login, gcloud Google.
  • gcloud compute config-ssh, SSH .
  • SSHing , ssh NAME.ZONE.PROJECT

    : ssh example-instance.us-central1-a.MY-PROJECT

  • :

    $ mkdir project.git
    $ cd project.git
    $ git init --bare

  • :

git remote add origin NAME.ZONE.PROJECT:/<PATH>/project.git

Git .

+6

remote . ( git add/set-url)


add

# Add new remote
git remote add godaddy1 $user1@foo.com:~/root.git 

-URL

# replace the current remote if want to replace instead of adding a new one
git remote set-url godaddy $user1@foo.com:~/root.git

# List all remotes
git remote -v
-1

All Articles