Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clearing All Assets In GitLab

I want to use custom logo-white, logo-black, and favicon in my company installation of GitLab.

I've Googled my butt off and tried eveything I can find to clear these damn images and nothing seems to work.

Here's the only process that seems to run successfully, yet it does not remove the images:

bundle exec rake cache:clear RAILS_ENV=production
service gitlab stop
redis-cli FLUSHALL
bundle exec rake assets:precompile RAILS_ENV=production
service gitlab start

Then I clear my browser cache and go to the domain and there are the same damn images again!

I even deleted all the logo and favicon files I could find completely from the application, and yet somehow they are still there.

HELP!

like image 722
Vince Kronlein Avatar asked Apr 03 '14 14:04

Vince Kronlein


3 Answers

There's a rake task assets:clean since version 6.0. So run bundle exec rake assets:clean RAILS_ENV=production from the command line and it will remove the assets.

After you nuke them, you'll probably want to run bundle exec rake assets:precompile RAILS_ENV=production to rebuild them.

like image 117
Steven V Avatar answered Oct 22 '22 09:10

Steven V


I was able to combine some of the info here, and successfully replaced the logo using the following steps (note that some commands are slightly different using the latest version of gitlab, 7.11.4, on CentOS 7, so I am adding this as an answer in the hopes that it will be helpful to users with the new version):

  • Replace the appropriate images in /opt/gitlab/embedded/service/gitlab-rails/app/assets/images
  • Stop gitlab using sudo gitlab-ctl stop
  • Refresh the rails cache sudo gitlab-rake assets:clean RAILS_ENV=production followed by sudo gitlab-rake assets:precompile RAILS_ENV=production
  • Start gitlab using sudo gitlab-ctl start

For some reason I was getting permission errors in the precompile step. This was solved by changing the write permissions to /opt/gitlab/embedded/service/gitlab-rails/public/assets/ to be globally writable (a+w). It seems that gitlab-rake runs as the git user, even though I used sudo. So, after the steps above, I also changed the owner to root (sudo chown -R root:root /opt/gitlab/embedded/service/gitlab-rails/public/assets), and the permissions back using a-w.

I assume that upgrading gitlab will revert the logo back to the original one, but I haven't tried that yet.

like image 39
Steve Avatar answered Oct 22 '22 09:10

Steve


I found the answer for anyone looking.

You also have to replace the images in

app/assets/images/

like image 2
Vince Kronlein Avatar answered Oct 22 '22 09:10

Vince Kronlein