Getting "fatal: this operation must be run in a work tree" after initializing a remote Git repo

I am super familiar with using Git on GitHub, but I am not at all familiar with git pushing to a custom machine instance.

I just figured out how to initialize a remote repo like this, last step being that I need to create a git init --bar "placeholder" thing on the remote server, under ~/project.git.

Then I went ahead and did this locally:

git remote add google example.us-west2-a.project:project.git
git push google master

And got the famous:

Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 8 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (4/4), 433 bytes | 216.00 KiB/s, done.
Total 4 (delta 0), reused 0 (delta 0)
To example.us-west2-a.project:project.git * [new branch] master -> master

Now, when I cd project.git on the remote machine, I notice it's similar to the .git folder inside my local project. And if I try to git status, I get the message:

fatal: this operation must be run in a work tree

So what do I do? I want to do a git push locally to push the contents of my git repo to my remote server, but I don't see any contents. How do I get and use the contents on the remote server? This way, I can then cd project on the remote server, and do node server to test out my node app. Later on I can do a git post-push hook or something, like Heroku does, to deploy a new version of the app.

Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like