Skip to content
Snippets Groups Projects

changeRemote

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by Laurent Heirendt
    Edited
    changeRemote.sh 384 B
    #!/bin/sh
    find * -maxdepth 0 -type d \( ! -name . \) -print | while read dir
    do
        # replace the remote
        if test -f "$dir/.git/config"; then
            cd $dir/.git;
            sed -i '' 's/git-r3lab-server\.uni\.lu/gitlab\.lcsb\.uni\.lu/g' config;
            cd ../..;
            echo " + Remote changed in $dir.";
        else
            echo " - The directory $dir is not versioned."
        fi
    done
    • This is a oneliner but with no output on what it does, so be warned :)

      find . -path "*/.git/*" -name "config" -type f
      # if you are sure you wan't to update all the listed file you can then run
      find . -path "*/.git/*" -name "config" -type f -exec  sed -i '' 's/git-r3lab-server\.uni\.lu/gitlab\.lcsb\.uni\.lu/g' {} +;
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment