/gitTools

simple bash/zsh scripting tools to add, del, list GitHub repos

Primary LanguageShellMIT LicenseMIT

git tools

easy-to-use shell scripts for GitHub
version 1.2.2 for Linux | Windows | Apple

Easily create, list, or delete repos from the command line

      $> gt add shinyNewRepo
      $> gt ls
      $> gt del oldRepo

download the scripts!            download the scripts for Apple!

Setting Up the Scripts
  • set up GitHub credentials if you don't have a home/USERID/.git-credentials file

  • set up for Linux
    • sudo apt install curl
    • unzip gt into (for example): /home/USERID/bin/gt/
    • set your $PATH to include /home/USERID/bin/gt
    • chmod u+rwx /home/USERID/bin/gt/gt.sh
    • (.bashrc) alias gt='/home/USERID/bin/gt/gt.sh'
    • test it by typing: gt
  • set up for Windows
    • download and install cygwin
    • add C:\cygwin64\bin to your %PATH%
    • unzip gt into (for example): C:\USERID\bin\gt\
    • set your %PATH% environment variable to include the gt directory
    • test it by typing: gt

Running the Scripts
The scripts use code that works for both bash and zsh (Apple uses zsh).
There is a main script called gt.sh that then calls sub-scripts for each command.

You can do things like:
  • gt add repoName --public (create a public repo and local directory connected to it)
  • gt ls -sc (show a list of repos, sorted by creation date)
  • gt rm oldRepo (delete a repo on GitHub but leave the local directory intact)
  • gt help
  • bash /home/bin/gt/gt.sh ls (run it explicitly with bash or zsh)
Potential Future Work
Here is a short list of potential features and commands for gt. Let me know if you have thoughts or want to contribute.

list -details a way to pick details or columns to show
-q quiet mode so that the scripts can pipe or be part of another script
add --noLocal add a new repository, but don't create a new local dir
stats create a view that shows stats for one or all repos, the user, etc
acp a command that takes a file, adds it, commits it, and pushes it
undo undo for staged, committed, pushed files
history tracking local repos, locally logging stats like git use-frequency
more authentication support GitHub supports multiple authentication mechanisms
snapshot grab/clone a repo, compress, and store it in a well-established location
non-bash version investigate octokit.js and a more expansive coding environment
search I have ideas on a more general search/copilot tool
Beyond GitHub: what are we really trying to do? write up on a more general system that addresses first principles of what we are trying to do (continuum of collaboration, publishing, sharing, backup, learning, etc).

Why Use gitTools?
Creating a new project should be easy. GitTools are simple shell scripts. A lot of commercial services, while powerful, are complicated and sometimes pricey. You will be relying on how these services:

  • access your code and company information (from userids to data use patterns)
  • manage application updates and fix bugs
  • address security leaks
  • introduce new features and remove old ones
  • mischeviously create product lock-in
  • help you with a contingency plan should they change privacy policies

That said, git is complicated. Tools to simplify the process will reduce development friction and promote better programming practices. I do a lot of collaborative prototyping, so being able to spin up a repo in a single command shifts the cognitive load. And believe me, I can use that.

gitTool Benefits
easy-to-use
customizable
transparent (you can read the scripts)
ubiquitous (same code runs on lots of platforms)
maintainable (written in modules)
open source (liberal MIT licensing)

Installation, Development, and Maintenance Benefits
easy to install
no opaque exe files to maintain
works in Windows too
each command is a separate script
modular architecture so creating new commands is easier
Related Links
Installing Git
GitHub Documentation
Bash Reference Manual
13 resources for learning to write better Bash code

GitHub REST API for Repos
Classic Personal Access Token
GitHub: Authenticating for the REST API
Github: Authenticating in General

GitHub CLI
GitHub Desktop

Scripting with the REST API and JavaScript
setting up GitHub credentials
whichShell
gitTools

A shout out to Amit, Kim, and Julio for help on gt and on broader concepts around computer technology, people, and innovation.
link to html of this page