Simple guide to start with Git/GitHub

My today’s post about simple actions that should be performed by Git users to initialize local environment for working with GitHub hosting.

Prerequests: there is valid GitHub user’s account which is added as collaborator to some repo.

Actions to init:

  1. Install Git (http://git-scm.com/), create SSH keys. Refer here.
  2. Create local folder for repo
  3. Run Git command prompt and navigate into prepare directory
  4. Run git init command
  5. Run git remote add <remote name> <remote link> command, <remote name> it is just a simple alias word (choose any), <remote link> it is SSH link for your repo (take it from GitHub).
  6. Run git pull <remote name> master command – it will bring all repo’s content locally

Actions to deliver stuff:

  1. Add/modify some file/directory
  2. Run git add . command to add all changes
  3. Run git commit –a –m “<commit comment>” to commit your changes
  4. Run git push <remote name> master to deliver your changes
  5. In case you see “! [rejected]        master -> master (non-fast-forward)” this means someone already committed some changes into this branch, so you need to update your local Git with new changes and only after this to deliver new one. Run git pull <remote name> master, after this repeat git push <remote name> master.
Advertisements

About DmitryKrinitsyn
Software developer and muay thai adept

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

%d bloggers like this: