YonderGit: Simplified Git Remote Repository Management | Jeet Sukumaran

YonderGit: Simplified Git Remote Repository Management

One of the great strengths of Git is the multiple and flexible ways of handling remote repositories. Just like Subversion, they can be "served" out of a location, but more generally, if you can reach it from your computer through any number of ways (ssh, etc.), you can git it. YonderGit wraps up a number of a common operations with remote repositories: creating, initializing, adding to (associating with) the local repository, removing, etc. You can clone your own copy of the YonderGit code repository using:
git clone git://github.com/jeetsukumaran/YonderGit.git
Or you can download an archive directly here: http://github.com/jeetsukumaran/YonderGit/archives/master. After downloading, enter "sudo python setup.py" in the YonderGit directory to install. This will just copy the "ygit.py" script to your system path. After that, enter "ygit.py commands?" for a summary of possible commands, or "ygit.py --help" for help on options.

Quick Summary of Commands

$ ygit.py setup  
Create directory specified by "REPO-URL", using either the "ssh" or local filesystem transport protocol, initialize it as repository by running "git init", and add it as a remote called "NAME" of the local git repository. Will fail if directory already exists.
$ ygit.py create 
Create directory specified by "REPO-URL", using either the "ssh" or local filesystem transport protocol, and then initialize it as repository by running "git init". Will fail if directory already exists.
$ ygit.py init 
Initialize remote directory "REPO-URL" as a repository by running "git init" in the directory. Will fail if directory does not already exist.
$ ygit.py add  
Add "REPO-URL" as a new remote called "NAME" of the local git repository.
$ ygit.py delete 
Recursively remove the directory "REPO-URL" and all subdirectories and files.

Valid Repository URL Syntax

Secure Shell Transport Protocol

  • ssh://user@host.xz:port/path/to/repo.git/
  • ssh://user@host.xz/path/to/repo.git/
  • ssh://host.xz:port/path/to/repo.git/
  • ssh://host.xz/path/to/repo.git/
  • ssh://user@host.xz/path/to/repo.git/
  • ssh://host.xz/path/to/repo.git/
  • ssh://user@host.xz/~user/path/to/repo.git/
  • ssh://host.xz/~user/path/to/repo.git/
  • ssh://user@host.xz/~/path/to/repo.git
  • ssh://host.xz/~/path/to/repo.git
  • user@host.xz:/path/to/repo.git/
  • host.xz:/path/to/repo.git/
  • user@host.xz:~user/path/to/repo.git/
  • host.xz:~user/path/to/repo.git/
  • user@host.xz:path/to/repo.git
  • host.xz:path/to/repo.git
  • rsync://host.xz/path/to/repo.git/

Git Transport Protocol

  • git://host.xz/path/to/repo.git/
  • git://host.xz/~user/path/to/repo.git/

HTTP/S Transport Protocol

  • http://host.xz/path/to/repo.git/
  • https://host.xz/path/to/repo.git/

Local (Filesystem) Transport Protocol

  • /path/to/repo.git/
  • path/to/repo.git/
  • ~/path/to/repo.git
  • file:///path/to/repo.git/
  • file://~/path/to/repo.git/

1 comment for “YonderGit: Simplified Git Remote Repository Management

  1. March 2, 2014 at 10:26 pm

    This is a neat script, and I like your blog! I thought I would share my personal technique for setting up a new git repo. I have become exceedingly fond of this mac utility ‘Dash’ by Kapeli, it’s an amazing documentation manager and does snippets as well, in the form of text-expansion.

    I use the following ‘snippet’ in my shell each time I start a git repo (underscore-delineated identifiers are variables that Dash presents via overlay to be filled-in):

    git init
    git remote add origin git@github-personal:SteveBenner/__repository-name__.git
    echo "# Repo and README created using an automated script, b*tch\!" >> README.md
    cp -n ~/.gitignore_global .gitignore
    git add -A
    git commit -m "Initial commit for git repo stored on Github.com."
    git push -u origin master

    The ‘@github-personal’ in the git URL refers to an alias in my SSH config file, where I use custom host settings to remove the worry of managing SSH keys, URL protocols, SSH/git settings, all that jazz.

Leave a Reply

Your email address will not be published. Required fields are marked *