git between two local machines setup [self reminder];

by

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.

Probably old-hat for git pros, but that I’m not (yet) :).

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.

Join 1,166 other followers

%d bloggers like this: