1

I use the following alias in .zshrc on Arch Linux to git pull all repositories in a directory in parallel:

alias multipull="find . -maxdepth 5 -name .git -type d | rev | cut -c 6- | rev | parallel -j64 'echo -n {}... && git -C {} pull'"

This works fine when the gnome-keyring is already unlocked but when it is not, it will prompt for each repository separately.

Ideas

  1. get GNU parallel to execute the first one serially and only then continue
  2. manually trigger the GNOME keyring unlock window (I found several solutions on StackOverflow for Ubunutu but none for Arch Linux) and then && it with the existing code

But other approaches are welcome as well. However I am not looking for a way to execute it serially. While that solves the problem it is much slower.

P.S.: Opened an issue at https://gitlab.gnome.org/GNOME/gnome-keyring/-/issues/102.

Konrad Höffner
  • 11,100
  • 16
  • 60
  • 118
  • 1
    IMHO the best answer you will find i your idea 2. – LeGEC Jan 20 '22 at 08:43
  • @LeGEC: Yeah, but how do I do that? – Konrad Höffner Jan 20 '22 at 08:44
  • There's a whole slew of things to try [here](https://wiki.archlinux.org/title/GNOME/Keyring). I don't know whether you're using libsecret or ssh but in either case you should be able to just run the appropriate command (`git-credential-libsecret fill` or `ssh $host exit 0`) directly, perhaps, and then fire up the parallel operation. – torek Jan 20 '22 at 21:33
  • 1
    Note that if you don't run `git fetch` or `git pull`, or even if you do, with a flag, as in [Ole Tange's answer](https://stackoverflow.com/a/70793431/1256452), this isn't really a *Git* issue so much as a gnome-keyring issue. I added the [tag:gnome-keyring-daemon] tag here. – torek Jan 20 '22 at 21:34

1 Answers1

0

Idea 2. You probably know of one of the git repositories that is fast to pull. Run that manually first. Maybe you can even create one with that purpose alone.

If you want to pursue idea 1, you can use (untested):

do_pull() {
  seq="$1"
  git="$2"
  if [ 1 = "$seq" ] ; then
    # this is job 1
    touch flag
  else
    while [ -e flag ] ; do
      # Wait for file flag to vanish
      sleep 1
    done
  fi
  echo -n "$git..."
  git -C "$git" pull
  rm -f flag
}
export -f do_pull
alias multipull="touch flag; ... | parallel -j64 do_pull {#} {}"
Ole Tange
  • 31,768
  • 5
  • 86
  • 104