Skip to content

У .sh скрипта меняются права на Ubuntu, что отображается в Changes not staged for commit  #3

@artemijkurganov

Description

@artemijkurganov
> ls -la
-rwxr-xr-x  1 kurganov kurganov  499 Oct  8 14:33 apply-gitconfig-for-nix.sh*
  • Открываем проект в VS Code
> ls -la
-rw-r--r--  1 kurganov kurganov  499 Oct  8 14:35 apply-gitconfig-for-nix.sh

У файла поменялись права, поэтому файл отобразится в Changes not staged for commit

> git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   apply-gitconfig-for-nix.sh
> git diff apply-gitconfig-for-nix.sh
diff --git a/apply-gitconfig-for-nix.sh b/apply-gitconfig-for-nix.sh
old mode 100755
new mode 100644

Файл будет постоянно отображаться в Changes not staged for commit, что может сбить с толку студентов, впервые изучающих git. Быстро проблему решает команда git config core.filemode false:

https://stackoverflow.com/questions/1257592/how-do-i-remove-files-saying-old-mode-100755-new-mode-100644-from-unstaged-cha

Скорее всего, какой-то конфликт wsl2 и VS Code на винде

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions