How to revert a change and then re add the change that has been added as a root user

StackOverflow https://stackoverflow.com/questions/22447493

  •  15-06-2023
  •  | 
  •  

Frage

I have a bit of a troublesome problem. Someone accidentally pushed to my gitlab page with some root files, and it caused a 500 encoding error for the commit data and the whole directory tree. I've had this happen before, and is what I usually due is just revert that change and tell them to re add and re commit everything only making sure everything as set as a normal user. Unfortunately, this person had a large commit that I doubt he could remake accurately.

I've already tried reverting the change, and then reverting my revert to see if that would work which didn't. So I'm out of ideas, and not really sure what to try next.

Any help is much appreciated.

Thanks, Joshua

War es hilfreich?

Lösung

Ouch! As a general rule I try to use only one user per repo (other users can clone it it and sync using push and pull).

If you revert your change and then make it again as a normal user, there is a risk that some funny file still remains, in fact some funny files will certainly still remain inside the hidden .git tree. I would instead force everything to be owned by your main user. Assuming you have such a "main" user for this repo you can try

  (become root)
  cd DA_REPO
  chown -R mainUser:herGroup .

This should set the ownership on all files in the working directory AND in the hidden .git directory. I admit I am hazy if -R actually descends into hidden directories. So if it doesn't work can also try an explicit

  chown -R mainUser:herGroup .git

[Update] Upon reading the original question, I see it talks about a "500 Encoding Error". It don't know what that means, or how it comes about, but it sounds like you have a version of a file with some bad characters in it. Git shouldn't care about that, but your program might. Find out what those files are and replace them with working ones. Also can you give more Detail about the erors you get?

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top