#!/bin/bash

logfile=/var/opt/gitlab/git-data/repositories/check.log

for f in /var/opt/gitlab/git-data/repositories/*;
  do 
    for repo in "$f"/*;
      do 
        if [[ $repo != *"backup"* ]]
        then
          [ -d $f ] && cd "$repo" && echo "Checking repo $repo++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" >> $logfile && git fsck >> $logfile 2>&1 
        fi
      done;
  done;
