0

I have join a company and my company has GitHub account and It has 50 repositories I want to clone all the repositories in one go Is there any way to clone all repositories by run bash script

https://github.com/CompanyName
phd
  • 82,685
  • 13
  • 120
  • 165
contactMon
  • 76
  • 1
  • 8
  • Sure, you make a list of all repository names and then a bash script that iterates over that list. In each iteration you concatenate the full repository path to be cloned and do exactly that. – arkascha Jan 13 '19 at 12:21
  • A simple google search revealed these among the first hits: https://bobbelderbos.com/2012/07/simple-bash-script-to-clone-remote-git-repositories/ and https://benito-zaragozi.com/snippets/clone-multiple-git-repositories-when-setting-up-your-ubuntu/ – arkascha Jan 13 '19 at 12:23
  • So I have to make repository name list. Is this possible by organisationName ? – contactMon Jan 13 '19 at 12:29
  • You can't parse the web front end for the list, since it is paginated. You'll have to check if their API documentation shows an endpoint to retrieve such a list. – arkascha Jan 13 '19 at 12:31
  • 1
    Seems this is the answer to your question: https://stackoverflow.com/questions/8713596/how-to-retrieve-the-list-of-all-github-repositories-of-a-person – arkascha Jan 13 '19 at 12:35

1 Answers1

-3

Create an array with the repositories:

arr=("repoa" "repob" "repoc")

Create a for loop to clone all repos:

for i in ${0..49}; do git clone https://github.com/CompanyName/${arr[${i}]}; done

I would recommend using the repo tool with a designated manifest for your purpose.