Not able to use cd Getting fatal: Not a git repository (or any of the parent directories): .git

Palash Nigam

I am using zsh on an Ubuntu 16.04

Since today I have not been able to use the cd command. Whenever I try to change my directory from the terminal I get this error fatal: Not a git repository (or any of the parent directories): .git

I took a look at my .zshrc to see if an alias might have changed cd to a git command, but I couldn't find any.

I was making some changes to my .zshrc today and I did see an error message after making those changes and reloading the shell but I ingored it and once I changed my config back to the way it was and I reloaded the shell the error/warning went away but after that I noticed that cd wasn't working.

Is there a way I can see or trace what program a unix command is hitting so that I can get to the root of this problem

EDIT: My zsh autocomplete works with cd but when I press enter I get this error.

This is the output of which cd

cd () {
    if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]
    then
        git push origin "${*}"
    else
        [[ "$#" = 0 ]] && local b="$(git_current_branch)" 
        git push origin "${b:=$1}"
    fi
}

Nathan J

You can try to check what is linked to cd with this command

which cd

If the setup is standard, you should get this message:

cd: shell built-in command

If it's not the case then you can see what causes the problem.

If you are using oh-my-zsh, this can come from it too since it's a git-based project.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

git: fatal: Could not read from remote repository

From Java

Receiving "fatal: Not a git repository" when attempting to remote add a Git repo

From Java

Git push: "fatal 'origin' does not appear to be a git repository - fatal Could not read from remote repository."

From Dev

git fatal not a git repository (or any of the parent directories) .git

From Dev

Heroku - Fatal error when pushing to a git repository

From Dev

git clone --bare: fatal: repository does not exist

From Dev

SourceTree - git: fatal: remote error: Repository not found

From Dev

use git repository on mac

From Dev

fatal: Not a git repository: when adding files to git repo

From Dev

git not able to clone after forking a private repository

From Dev

GIT: fatal: 'master' does not appear to be a git repository

From Dev

Why am I getting error "fatal: 'C:/Program Files (x86)/Git' is outside the repository" when I run "git reset --hard ~1" from within the repository?

From Dev

fatal: Not a git repository (or any of the parent directories): .git in Mac OS

From Dev

Git -> cannot access parent directories: bad address

From Dev

Redmine error log fatal:not a git repository

From Dev

Can't run GNU Smalltalk gst; fatal: not a git repository (or any of the parent directories): .git

From Dev

Can't run GNU Smalltalk gst; fatal: not a git repository (or any of the parent directories): .git

From Dev

Fatal: not a git repository - after BSoD

From Dev

fatal: Not a git repository (or any of the parent directories): .git (And yet the repository exists)

From Dev

Heroku - Fatal error when pushing to a git repository

From Dev

git not able to clone after forking a private repository

From Dev

.bashrc running an alias without my approval: fatal: Not a git repository (or any of the parent directories): .git

From Dev

Why am I getting error "fatal: 'C:/Program Files (x86)/Git' is outside the repository" when I run "git reset --hard ~1" from within the repository?

From Dev

Capistrano DigitalOcean Ubuntu 14.04 fatal: Not a git repository (or any of the parent directories) .git

From Dev

Are .gitignore files from directories above the repository's or from home directory loaded in any versions of Git?

From Dev

Git fatal not valid : is this a git repository?

From Dev

Storing complete git repository in parent git repository

From Dev

fatal: Not a git repository (or any parent up to mount point /)

From Dev

Docker image git clone error "fatal: Not a git repository"

Related Related

  1. 1

    git: fatal: Could not read from remote repository

  2. 2

    Receiving "fatal: Not a git repository" when attempting to remote add a Git repo

  3. 3

    Git push: "fatal 'origin' does not appear to be a git repository - fatal Could not read from remote repository."

  4. 4

    git fatal not a git repository (or any of the parent directories) .git

  5. 5

    Heroku - Fatal error when pushing to a git repository

  6. 6

    git clone --bare: fatal: repository does not exist

  7. 7

    SourceTree - git: fatal: remote error: Repository not found

  8. 8

    use git repository on mac

  9. 9

    fatal: Not a git repository: when adding files to git repo

  10. 10

    git not able to clone after forking a private repository

  11. 11

    GIT: fatal: 'master' does not appear to be a git repository

  12. 12

    Why am I getting error "fatal: 'C:/Program Files (x86)/Git' is outside the repository" when I run "git reset --hard ~1" from within the repository?

  13. 13

    fatal: Not a git repository (or any of the parent directories): .git in Mac OS

  14. 14

    Git -> cannot access parent directories: bad address

  15. 15

    Redmine error log fatal:not a git repository

  16. 16

    Can't run GNU Smalltalk gst; fatal: not a git repository (or any of the parent directories): .git

  17. 17

    Can't run GNU Smalltalk gst; fatal: not a git repository (or any of the parent directories): .git

  18. 18

    Fatal: not a git repository - after BSoD

  19. 19

    fatal: Not a git repository (or any of the parent directories): .git (And yet the repository exists)

  20. 20

    Heroku - Fatal error when pushing to a git repository

  21. 21

    git not able to clone after forking a private repository

  22. 22

    .bashrc running an alias without my approval: fatal: Not a git repository (or any of the parent directories): .git

  23. 23

    Why am I getting error "fatal: 'C:/Program Files (x86)/Git' is outside the repository" when I run "git reset --hard ~1" from within the repository?

  24. 24

    Capistrano DigitalOcean Ubuntu 14.04 fatal: Not a git repository (or any of the parent directories) .git

  25. 25

    Are .gitignore files from directories above the repository's or from home directory loaded in any versions of Git?

  26. 26

    Git fatal not valid : is this a git repository?

  27. 27

    Storing complete git repository in parent git repository

  28. 28

    fatal: Not a git repository (or any parent up to mount point /)

  29. 29

    Docker image git clone error "fatal: Not a git repository"

HotTag

Archive