Posted in Workflow

Setting up a second machine to work with your existing github repository

I’ve been working on a PC and backing up to github, but with a Macbook Air at my disposal, why bother sitting up at the computer? 😛  To set up your second machine (y’know, the one you can balance on your belly in bed) to access an existing github repository, pull down the files and then push the changes back up:
git init
git remote add origin git@github.com:username/repo.git
git pull origin master
/* work, work, work... */
git commit -am "comments on changes"
git push origin master

Or, to combine a few of those steps:
git init
git clone git@github.com:username/repo.git
/* work, work, work... */
git commit -am "comments on changes"
git push origin master

(git clone does the same as git remote add origin and git pull origin master)

(See follow-up post here to explain the struck-out text here.)

To keep both repositories in sync, you’ll want to pull the latest changes to your machine before you start work.

Via StackOverflow

Advertisements

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