repo zipper

Have you ever needed to zip a git repository? Well, this is fairly simple with git git archive --format zip --output <output_path> HEAD But what about if you need to zip multiple repositories at once? This might get tedious. Bash scripting to the rescue Worry no more! Create a repoZipper.sh file with the following content #!/bin/bash # Set the name of the output archive file OUTPUT_ARCHIVE="repos.zip" # Create a temporary directory to store the cloned repositories TEMP_DIR=$(mktemp -d) echo "Working temporary directory: ${TEMP_DIR}" # Loop through each repository URL passed as input while read -r REPO_URL do # Extract the repository name from the URL REPO_NAME=$(echo "${REPO_URL}" | cut -d'/' -f2) # Clone the repository git clone "${REPO_URL}" "${TEMP_DIR}/${REPO_NAME}" # Create a zip archive of the repository pushd "${TEMP_DIR}/${REPO_NAME}" || exit git archive --format=zip --output="${TEMP_DIR}/${REPO_NAME}.zip" HEAD popd || exit done # Combine all individual repos into one archive pushd "${TEMP_DIR}" || exit zip -r "${OUTPUT_ARCHIVE}" ./*.zip popd || exit # Move the output archive to the current directory mv "${TEMP_DIR}/${OUTPUT_ARCHIVE}" . # Remove the temporary directory rm -rf "${TEMP_DIR}" Then create a file repos.txt with the list of repositories to zip ...