Reputation: 1826
I have an Angular project that is stored locally on my machine. I have added a remote for this directory, C:\Users\myName\homeRedesign
, on a folder I created on a network drive, P:\homeRedesign
.
I tried running git init
on the destination folder but received this issue:
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository is denied...
After this, I tried running git init --bare
. I can now run git push
without issues but when I look in the folder, I only see files created by Git. I have confirmed I'm on master branch (the only branch) by running git branch
.
Why can't I see my project's folders and files?
Upvotes: 0
Views: 437
Reputation: 175098
The idea of a bare repository is that it's a repository with no working directory (i.e. only the repository itself, what's under the .git
directory in a normal repo).
A bare repository is used only as a push/pull remote location, and it is not expected that you work on it. In past versions of Git, git push
would not be possible at all for non-bare repos (as opposed to today's "not possible by default") because of conflicts that may arise with the remote repo working directory.
What you are seeing is the expected behavior.
See How do you use "git --bare init" repository? for more information on setting up a bare repository as a remote.
Upvotes: 3