This script is designed to streamline the initial setup process for developers joining a project. It automates the creation of an SSH key, provides instructions for adding it to GitHub, and clones a specified repository from the GuideToIceland organization.
- Interactive Setup: Prompts the user for the email address associated with their GitHub account.
- SSH Key Management:
- Checks if an
id_ed25519SSH key already exists. - If no key is found, it generates a new one automatically.
- Checks if an
- Guided GitHub Integration: Displays the new public SSH key and provides clear, step-by-step instructions for adding it to the user's GitHub account settings.
- Flexible Repository Cloning:
- Clones a specific repository from the
GuideToIcelandorganization by passing its name as an argument. - If no repository name is provided, it defaults to cloning
monorepo.
- Clones a specific repository from the
- User-Friendly: Provides clear headers and status messages, guiding the user through each step of the process.
Before running this script, ensure you have the following command-line tools installed on your system:
gitssh-keygencurl(if you plan to run the script directly from a URL)
There are two primary ways to use this script: running it from a local file or executing it directly from a remote URL.
You can run this script directly from its raw GitHub URL without downloading it first. This is a convenient way to share and run the setup process.
-
Get the Raw URL: Navigate to the script file in the GitHub repository and click the "Raw" button to get the direct link to the file.
-
Run the Command:
- To run the script and clone the default repository (
monorepo):curl -sS https://raw.githubusercontent.com/GuideToIceland/setup/main/setup.sh | bash - To pass an argument and clone a specific repository (e.g.,
guide):curl -sS https://raw.githubusercontent.com/GuideToIceland/setup/main/setup.sh | bash -s guide
- To run the script and clone the default repository (
-
Save the Script: Save the script content into a file named
setup.sh. -
Make it Executable: Open your terminal and grant execute permissions to the file:
chmod +x setup.sh
-
Run the Script:
- To clone the default repository (
monorepo):./setup.sh
- To clone a different repository (e.g.,
guide):./setup.sh guide
- To clone the default repository (
- Argument Handling: The script first checks if an argument (a repository name) was provided. If not, it sets
monorepoas the default target. - Email Prompt: It asks for your GitHub-associated email, which is used to label the new SSH key.
- SSH Key Check: It looks for an existing public key at
~/.ssh/id_ed25519.pub. - Key Generation: If no key is found, it runs
ssh-keygenwith the provided email to create a new key pair without a passphrase, accepting the default file location. - GitHub Instructions: The script then displays the public key and pauses, instructing you to add it to your GitHub account. This is a crucial manual step.
- Clone Repository: After you confirm that the key has been added to GitHub by pressing Enter, the script proceeds to run
git cloneusing the SSH URL for the target repository.