简体   繁体   中英

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!

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.

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 aw .

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

I found the answer for anyone looking.

You also have to replace the images in

app/assets/images/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM