Getting “fatal: This operation must be run in a work tree?” on bare repository
git, github, version-control
Solution
Since it is a bare repo, it has no working tree. See "What's the -practical- difference between a Bare and non-Bare repository?".
You should clone locally that folder2 repo, in order to execute your commands.
# on server:
cd /path/to/folder2
git clone folder2 folder2b
cd folder2b
git status
Note: It would be best to follow the naming convention for bare repo directory: `folder2.git` (instead of `folder2`)
Problem
I'm a newbie when it comes to git and i went through some video tutorials here After seeing these tutorials i tried to set up a git repo with my friend using ssh Note: - We are using mac snow leopard - The Git version is 1.7.5.4 I managed to set up my code in a folder lets say 'folder1' using ``` git init ``` which has my code files . Then I create an empty repository on my friends machine lets say '`folder2`', and I made `folder2` a bare repository using ``` git init --bare --shared ``` Now I wanted to setup the shared repo as the repository for `folder1`'s code After this, I tried to add the remote on the bare repo using ssh ``` git remote add origin myFriend@hisIp:/LocationToFile ``` After this, I pushed the code which gave me a successful message Now the issue is that the git repo '`folder2`' is still show an empty repo (with the folders of an empty repository) and I cant perform git operations in `folder2` as even if I do "`git status`", I get "`fatal: This operation must be run in a work tree`"