SleepyWakes
SleepyWakes

Reputation: 101

GCS Cloning GitHub Repos to Compute Engine VM

I have a basic question on my first attempt to deploy a Node.js app on Google Cloud Services using a Compute Engine Virtual Machine.

I have created a Google Cloud Repository of my GitHub code. I have tried to clone this repo onto my virtual machine. When I do it, I show the repo name, but that directory is empty.

enter image description here

Am I supposed to have the actual files inside this directory, or is it some link to the Google Cloud Repo and it only appears empty? If the files are supposed to physically be in this directory, that could explain why I can't get my startup script to run.

And if they are supposed to be in there, I'm not sure why they don't clone but it could be because my path to default code GitHub is messed up.

Thanks in advance. I have been stuck on this for too long.

EDIT: I used: I used gcloud source repos clone github_sleepywakes_thunderroost --project=imposing-timer-334919 to clone my repo

When I use it again, I get this message:

WARNING: Repository "github_sleepywakes_thunderroost" in project "imposing-timer-334919" is a mirror. Pushing to this clone will have no effect.  Instead, clone the mirrored repository directly with
$ git clone https://github.com/SleepyWakes/ThunderRoost
Cloning into '/home/overlord/github_sleepywakes_thunderroost'...
remote: Total 1581 (delta 264), reused 1581 (delta 264)
Receiving objects: 100% (1581/1581), 3.43 MiB | 9.59 MiB/s, done.
Resolving deltas: 100% (264/264), done.
warning: remote HEAD refers to nonexistent ref, unable to checkout.

So it appears my files are copied, but when I change directory into github_sleepywakes_thunderroost and ls, the directory is empty.

Upvotes: 0

Views: 863

Answers (1)

SleepyWakes
SleepyWakes

Reputation: 101

My GitHub repository brand was named "main" rather than "master." Google Cloud Shell apparently looks for master so could not link to the correct path. In GitHub, I deleted the main branch and pushed my code to a new repository called master. I then was able to clone the GitHub repository.

There are likely other ways to fix this.

Upvotes: 1

Related Questions