1

I am in a Git repository:

$ cd /Users/me/dev/example
$ git status
On branch master
nothing to commit, working tree clean
$ pwd
/Users/me/dev/example

I ran these:

gcloud compute config-ssh
ssh example.us-west2-a.project

I even installed git on the remote instance:

sudo apt-get update
sudo apt-get -y install git

I added the remote like this:

git remote add google example.us-west2-a.project:$(pwd)

But when I git push google master, I get this:

fatal: '/Users/me/dev/example' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

What is going wrong, how do I git push to my google instance without first creating the repo manually on the instance?

1 Answer 1

1

how do I git push to my google instance without first creating the repo manually on the instance?

You don't. With the standard Git tools, it always needs to be created first (using git init --bare).

(Also, usually Linux home directories are kept at /home, not at /Users, so auto-creation wouldn't have worked in your case anyway.)

You can however find the "push to create" feature in Gitea and possibly also in GitLab, if you're willing to use either of those.

3
  • How does heroku work then? Don't I just do git push heroku master? Or are they upon heroku create creating a git repo on their server?
    – Lance
    Commented Jul 28, 2020 at 6:17
  • Can you show the commands that I should run on both local and remote machines?
    – Lance
    Commented Jul 28, 2020 at 6:17
  • Heroku runs heavily customized server software, so they might pre-create the repo on 'heroku create' (I would expect) or they might have made customizations like Gitea and GitLab did to allow auto-creating. Commented Jul 28, 2020 at 7:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .