Scott Penrose

Git Add

Scott is an expert software developer with over 30 years experience, specialising in education, automation and remote data.

Git Tools Add

Add a remote repository to a local GIT repo. You have a defined set of repo types you use by convention. E.g.

  • key = USB Key
  • bak = Backup repo (I have mine on an SSH server)
  • github = Github account
  • s3 = Amazon S3
  • etc

From my local git repo, I want to add "bak" to keep backup copies of my repo, or to allow me an easy way to move between my laptop and workstation. All I need to do is type "git_add bak" and it is done. What is actually happening depends on what is local and what is remote:

  • "bak" already exists on local repo - do nothing, exit gracefully
  • "bak" does nto exist locally, but does remote, just add the remote by name.
  • "bak" does not exist locally, and the repo does not exist remotely.
    • USB & SSH - create bare repo and copy it across (e.g. cp, or ssh, rsync)
    • S3 - just add key, repos created on the fly
    • Github - Use the github REST API to create the repo

All I want to do is "git_add s3" or "git_add key" - I don't want to know if it already exists or not, and I don't want to worry that on one machine it is /Volumes/LaCie vs another machine which is "/mnt/lacie" etc. This is all handled for me automatically.

  • Git