Y
Y
yellow_pus2022-03-22 13:02:02
git
yellow_pus, 2022-03-22 13:02:02

How to revert file permissions in git?

Accidentally launched

sudo git add . -> sudo git commit ..., sudo git push ..
instead of the same commands, but without sudo. Now, in the github there is +5k modified files, with different changed rights. How it is possible to roll back all changes of the rights back?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Kuznetsov, 2022-03-22
@yellow_pus

The repository does not store file permissions, nor does it store other attributes. A commit is not copying files to a new location, but parsing and saving their original state to a database.
The only attribute that git stores is the attribute of the executable file.

core.fileMode
Tells Git if the executable bit of files in the working tree is to be honored.

And under whom you committed, it doesn’t matter at all. And it certainly doesn't matter who pushed the commits to the external repository (push). Commits are signed with a hash and will definitely not change when transferred.
File permissions are set when they are checked out to the working directory (checkout), and the owner will be the user who checked out.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question