Friday, March 8, 2013

Github Pulls Between two Computers

So I just got my work computer and I have been navigating how I will work on projects from both work and home without bringing computers both ways and Ta-Da Github Pull Requests did the trick.

Step 1: Clone Repository Locally

  • $ cd folder_you_want 
  • $ git clone git@github.com:username/project-name.git

Step 2: Remotely Connect and Pull

  • $ git init
  • $ git remote add origin git@github.com:username/project-name.git
  • $ git pull origin master
From here on out you can just type in the command line ($ git pull origin master) and you will be able to pull the most up to date master code base.

*If you get this error: This means your SSH has not been set up properly and you will need to generate one from your computer and add it to your Github Account.

Permission denied (publickey).
fatal: The remote end hung up unexpectedly

Step 3: Generate SSH and Add to Github Account
  • $ ssh-keygen -t rsa -C "your_email@example.com"
  • Enter file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]
  • Enter passphrase (empty for no passphrase): [Type a passphrase]
  • Enter same passphrase again: [Type passphrase again]
  • $ pbcopy < ~/.ssh/id_rsa.pub # Copies the contents of the id_rsa.pub file to your clipboard
  • Go to your Account Settings
  • Click "SSH Keys" in the left sidebar
  • Click "Add SSH key" and Paste Key into it
  • FINISHED!
And that's it, pull and push to your repository from any computer anywhere in the world, thank you for making life easy Github.

No comments:

Post a Comment