I'm following the Git Pro book ( http://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server ) to set up my first git remote server on Ubuntu. After I follow this:
$ git remote add origin git@gitserver:/opt/git/inventory.git
$ git push origin Windows
I receive this message:
Counting objects: 33, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (28,28) done.
Writing objects: 100% (33/33), 7.30 KiB | 0 bytes/s, done.
Total 33 (delta 13), reused 0 (delta 0)
To git@gitserver:/opt/git/inventory.git
* [new branch] Windows -> Windows
But when I type git statuson the remote server (in /opt/git/inventory.git/) I get the error message fatal: This operation must be run in a work tree
The remote repository appears to not contain any of the files from the local repository and when I clone the remote repository into a different local folder there are no files, just the .git folder.
I have looked at other related questions on here:
fatal: This operation must be run in a work tree
Why am I getting the message, "fatal: This operation must be run in a work tree?"
Getting “fatal: This operation must be run in a work tree?” on bare repository
but am no clearer as to why this is happening and what i can do to remedy it.
The remote repository in question is a bare repository.
It will only contain the packed objects and refs etc that git internally stores and won't have any of the regular code files checked out. As such, there will be no working tree, and hence no working git status.
That said, to check if your changes were pushed, just clone that repo in question to another location, and you will find your files all right:
git clone /opt/git/inventory.git some/location/inventory_clone
You might need to do a git checkout master in the newly cloned repo to actually see the code files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With