Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

raw Git repos list support #15

Open
alexkutsan opened this issue Aug 4, 2024 · 2 comments
Open

raw Git repos list support #15

alexkutsan opened this issue Aug 4, 2024 · 2 comments
Labels
enhancement New feature or request planned

Comments

@alexkutsan
Copy link

Describe the feature or enhancement

It would be very cool to have the ability to list down git repos with SSH/HTTPS credentials for backup, not sticking to specific platform

@alexkutsan alexkutsan added the enhancement New feature or request label Aug 4, 2024
@AkashRajpurohit
Copy link
Owner

This seems to be a good addition, do you want to work on this?

@alexkutsan
Copy link
Author

For now, I use a dummy shell script to meet my needs.

#!/bin/bash

# Check if backup directory is provided as an argument
if [ $# -eq 0 ]; then
    echo "Usage: $0 <backup_directory>"
    exit 1
fi

# Set backup directory from command line argument
backup_dir="${1:-./}"

# Check if backup_dir exists, if not create it
if [ ! -d "$backup_dir" ]; then
    mkdir -p "$backup_dir"
fi

# Check if repositories.txt exists
if [ ! -f "repositories.txt" ]; then
    echo "Error: repositories.txt file not found"
    exit 1
fi

# Read repositories from txt file
while IFS= read -r repo || [[ -n "$repo" ]]; do
    # Skip empty lines and lines starting with #
    [[ -z "$repo" || "$repo" == \#* ]] && continue
    
    repo_name=$(basename "$repo" .git)
    repo_path="$backup_dir/$repo_name"
    
    if [ -d "$repo_path" ]; then
        echo "Updating repository: $repo_name"
        cd "$repo_path"
        git pull
        cd - > /dev/null
    else
        echo "Cloning repository: $repo_name"
        git clone "$repo" "$repo_path"
    fi
done < "repositories.txt"

Extending the existing project would be complicated for me due to my lack of experience with Go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request planned
Projects
None yet
Development

No branches or pull requests

2 participants