I was trying to establish why a function on a website worked locally but not remotely, so my idea was to download the remote site and do a git diff in order to spot any differences.
Since I did this, however, all GIT commands are met with:
fatal: Unable to read current working directory
Have I killed my repo? is this reversible?
To do so, you need to navigate to the correct folder and then run the command git init , which will create a new empty Git repository or reinitialize an existing one.
We can fix the error: failed to push some refs to [remote repo] error in Git using the git pull origin [branch] or git pull --rebase origin [branch] commands. In most cases, the latter fixes the error.
The “Your local changes to the following files would be overwritten by merge” error occurs when you try to pull a remote repository to your local machine whose contents conflict with the contents of your local version of the repository. To fix this error, either stash your changes away for later or commit your changes.
I've run into this problem a few times. As silly as it may sound, closing the terminal window (or SSH session) and opening a new one solves the problem.
In your shell issue
cd "$PWD"
My guess is it doesn't exist/has been recreated. This happens also with dangling symlinks.
Otherwise, retreat to higher ground. Note, that depending on your shell cd ..
will or will not work (if the shell optimizes it, knowing the CWD, it may work, otherwise you'll be catch-22: the shell cannot lookup the inode for ..
:))
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