Tag: Git

  • Can a Git repository contain multiple .gitignore files in the root folder?

    No, a Git repository should only have one .gitignore file in the root folder. The .gitignore file in the root directory of your repository is meant to apply its rules to the entire repository. However, you can have multiple .gitignore files within different subdirectories of your repository, each applying only to the directory in which it is located and its subdirectories. This allows you to have specific ignore rules for different parts of your project.

    For example:

    • / (root directory)
      • .gitignore
      • /src
        • .gitignore
      • /docs
        • .gitignore

    Each .gitignore file can contain rules relevant to the files and directories at its level and below.

  • oh-my-zsh slow on WSL2 git directory

    You might notice oh-my-zsh very slow on WSL2 shell, especially when you cd into a directory with git enabled.

    This can be resolved by running following command

    git config --global oh-my-zsh.hide-status 1
  • git clone error “Operation not permitted” on WSL2 Shell

    On a clean installed WSL2 (Windows SubSystem for Linux Gen 2), you might get error “Operation not permitted” when trying to run command git clone on the shell.

    To resolve this, simple run following commands:

    sudo umount /mnt/c
    sudo mount -t drvfs C: /mnt/c -o metadata
    

    You might need to replace the drive letter if you hit error on other drivers.