git between two local machines setup [self reminder];

Had to figure this out again today, so thought I’d write it down so that I could find it next time, and maybe someone else would find it useful.

Situation:

git master rep on github.com

local repo on desktop

local repo on laptop

Made changes and several commits on my laptop, didn’t want to push them to origin (github) because not ready to impact rest of team yet, but wanted to work on my desktop (bigger screen, faster, more ram). So, needed to get my changes from laptop local repo to desktop local repo, but not via origin on github.

add new remote in git on desktop for laptop (I did this in Tower this time, but obviously can be done from command line via something like: git remote add laptop ssh://laptopname.local/Users/me/full/path/to/laptop/local/repo/).

Requirements:

Remote Login enabled in Sharing section of System Preferences

desktop ssh public key be in authorized_keys on laptop

both on local network (for .local host name use, can use ip address if not).

the remote address then is something like:

ssh://laptopname.local/Users/me/full/path/to/laptop/local/repo/

and then it works. Obviously you’ll likely want the same thing in reverse so you can move code from desktop to the laptop.