Page 76 of 170

GitLab: Your changes could not be commited, because the file has been changed

Not long ago I've migrated last of my SVN-managed projects into Git with GitLab (finally!). Everything was OK, until this message occurred, when I tried to do an web-based repository file update:

Your changes could not be commited, because the file has been changed

After googling I've executed following command (because I didn't create satellites earlier):

sudo -u git -H bundle exec rake gitlab:satellites:create RAILS_ENV=production

Unfortunately this didn't solve my problem (although I'm pretty sure, that either way this was required). I've decided to check GitLab logs, but unluckily nothing suspicious was there. I suddenly remembered, that by default all my Rails/Rack Passenger applications are executed using www-data user. This was a good guess. I've added a user declaration in Apache vhost configuration file:

PassengerUser git

and after that I've finally started to get some new things in application log:

Errno::EACCES (Permission denied - /home/git/gitlab/tmp/satellite_15.lock):
  lib/gitlab/satellite/satellite.rb:57:in `initialize'
  lib/gitlab/satellite/satellite.rb:57:in `open'
  lib/gitlab/satellite/satellite.rb:57:in `lock'
  lib/gitlab/satellite/action.rb:23:in `block in in_locked_and_timed_satellite'
  lib/gitlab/satellite/action.rb:22:in `in_locked_and_timed_satellite'
  lib/gitlab/satellite/edit_file_action.rb:22:in `commit!'
  app/controllers/edit_tree_controller.rb:18:in `update'

All my satellite locks were created by www-data user with different set of privileges, so git user was not able to use them. After I removed all the locks and restarted both GitLab and Apache server, everything started to work just fine:

sudo rm /home/gitlab/tmp/satellite_*
/etc/init.d/apache2 restart
/etc/init.d/gitlab restart

Converting MKV video file to MP4 with hardsubs (embedded subtitles) on Linux (Ubuntu)

I had to convert some MKV video files into MP4 format with embedded (rendered) subtitles. This would not be a problem if not the external ASS subs that I had. HandBrakeCLI can easily convert between those formats but it can use embedded ASS file (from MKV video) or provided SRT. There is no way to use an external ASS subtitles file. Luckily there is a quite simple solution for that issue: we can just remove original MKV video subtitles, add ours and then use HandBrakeCLI to convert the video.

Replacing the ASS MKV subtitles with our own

First we need to remove the original ASS subtitles that are stored in MKV file:

mkvmerge --no-subtitles source.mkv -o target.mkv

This will copy MKV file but will remove subtitles.

After that, we need to add our ow ASS file (subtitles.ass):

mkvmerge -o target_with_subs.mkv target.mkv -D -A subtitles.ass

Now we have a MKV file with our ASS subtitles, that we can use to create MP4 file.

Creating MP4 file with embedded (hardcoded) subtitles

Convertion is really simple:

HandBrakeCLI -i target_with_subs.mkv -o result.mp4 -e x264 -q 20 -B 160\
 --x264-preset medium --two-pass -O --turbo --subtitle "1" \
 --subtitle-burn "1" --srt-codeset utf8

Simple one line long command and 30 minutes later you have your MP4 file with hardsubs.

Copyright © 2025 Closer to Code

Theme by Anders NorenUp ↑