b37592e99d0c0ada2c13f498270c0d85e2fce44e
GetGit - Git Repository Setup Tool
A simple bash script that helps users set up SSH keys and clone repositories from a private git server.
Features
- SSH Key Generation: Automatically generates SSH keys if they don't exist
- Dynamic User Support: Works with any username on the git server
- Repository Discovery: Automatically discovers available repositories for the user
- Interactive Selection: Allows users to choose which repository to clone
- Dotfiles Support: Special handling for dotfiles repositories with automatic setup execution
Usage
-
Make the script executable:
chmod +x setup.sh -
Run the script:
./setup.sh -
Follow the prompts:
- Enter your git username
- Generate SSH key (if needed)
- Add the SSH key to your git account
- Select which repository to clone
How It Works
1. Username Input
The script prompts for your git username, which is used to:
- Discover available repositories
- Construct repository URLs
- Set up proper directory structure
2. SSH Key Management
- Checks for existing SSH key (
~/.ssh/id_ed25519) - Generates a new key if none exists
- Displays the public key for copying to your git account
3. Repository Discovery
The script automatically checks for common repository patterns:
username/dotfilesusername/scriptsusername/configsusername/toolsusername/projectsusername/notesusername/backupusername/workspace
4. Repository Selection
Users can:
- Select from numbered list of discovered repositories
- Press Enter to use
username/dotfiles(if available) - Type
customto enter a custom repository path
5. Cloning and Setup
- Clones the selected repository to the appropriate directory
- For dotfiles repositories: runs
setup.shautomatically - For other repositories: simply clones to
~/repository-name
Configuration
The script can be configured by modifying the settings at the top:
### === SETTINGS === ###
GIT_SERVER="git.del-c.net" # Change to your git server
Directory Structure
- Dotfiles:
~/.dotfiles/ - Other repos:
~/repository-name/
Requirements
- Bash shell
- Git installed
- SSH client
- Access to the configured git server
Example Flow
$ ./setup.sh
[?] Enter your git username:
Username: john
[+] No SSH key found. Need to generate a new SSH key...
[+] If you are using the correct user, please enter your email for the SSH key.
Enter your email for the SSH key: john@example.com
[*] Add the following public key to your GitHub account:
----------------------------------------
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGx... john@example.com
----------------------------------------
Press Enter after you've added the key...
[+] Fetching available git projects for user: john...
[*] Available repositories:
1. john/dotfiles
2. john/scripts
3. john/tools
[?] Which project would you like to download?
Enter the number of the repository from the list above, or:
- Press Enter to use john/dotfiles (if available)
- Type 'custom' to enter a custom repository path
Enter your choice: 1
[*] Selected repository: git@git.del-c.net:john/dotfiles.git
[*] Download directory: /Users/john/.dotfiles
[+] Cloning selected repository...
[+] Launching dotfiles setup using Bash...
Troubleshooting
SSH Key Issues
- Ensure the SSH key is added to your git account
- Check SSH connection:
ssh -T git@git.del-c.net
Repository Not Found
- Verify the repository exists on the server
- Check username spelling
- Ensure you have access to the repository
Permission Denied
- Confirm SSH key is properly added to git account
- Verify you have read access to the repository
Contributing
Feel free to submit issues and enhancement requests!
Description
A simple bash script that helps users set up SSH keys and clone repositories from a private git server.
Languages
Shell
100%