Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error with GIT after importing changes from a server

Tags:

git

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?

like image 798
Mild Fuzz Avatar asked Apr 21 '11 10:04

Mild Fuzz


People also ask

How do I fix a git error not a repository?

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.

How do I fix git error failed to push some refs to?

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.

How do you fix git error your local changes to the following files will be overwritten by merge?

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.


2 Answers

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.

like image 182
George P. Burdell Avatar answered Sep 28 '22 07:09

George P. Burdell


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 .. :))

like image 36
sehe Avatar answered Sep 28 '22 08:09

sehe