Home > Back-end >  Remote repo on Google Cloud VM - unable to connect and git push
Remote repo on Google Cloud VM - unable to connect and git push

Time:02-03

I'm trying to git push my project from my local computer to my Google Cloud VM. I set up a git repo on my local cpu as well as in my VM. When I do the following: git remote add live 'you@your-server:/path/to/bare_project.git / git push --set-upstream live master

I receive this error:

git : ssh: Could not resolve hostname johnbot: Name or service not known
At line:2 char:1
  git push --set-upstream live master
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      CategoryInfo          : NotSpecified: (ssh: Could not ...rvice not known:String) [], RemoteException
      FullyQualifiedErrorId : NativeCommandError
 
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

Perhaps I'm simply not inputting my server correctly. What exactly is my Google Cloud VM's address? Is is account@name-of-instance:/path/to/project', 'account@external-ip:...' I see some examples that say your host name contains the location of your VM. What am I doing wrong here? Thank you

CodePudding user response:

You cannot push from your local git repo to your VM because it is not running a git server.

Instead, push to a public/private repository (GitHub, GitLab, Google Cloud Source Repositories) and then clone/pull the repository from the command line at the VM.

  •  Tags:  
  • Related