GitHub: How to clone GitHub repo ? How to push to Github? How to get files from GitHub ? (Ubuntu)

20 Jan

GitHub is an online repository. Many people find it very confusing to use GitHub, so I’ve decided to share my experience of using it on Linux Ubuntu.

So in this post we will discuss:

1. How to set up and clone repo to your local machine avoiding message: Permission denied (publickey).
2. How to  transfer all changes you are making INTO Github
3. How to get those changes FROM GitHub

My way could not be the most efficient one, but it works for me. :)

How to setup up GitHub to your local machine ?

So for the first part, you need to download Git and set your SSH key. Thanks to the GitHub documentation,  step by step guide is here:

http://help.github.com/linux-set-up-git/

How to clone your repo to your local machine ?

(in git terminology it’s called “checkout“)

First you need to find your repo address. It can be find  on your GitHub repo page:

Copy the address in the box (git@github.com……/….git)

Open the terminal and go to the folder where you want to have your git to be located.

  Type command:

git clone ADDRESS YOU COPIED

Here is my output:

How to  transfer all changes you are making INTO Github ?

(in GitHub it is called Push)

There are 3 steps to transfer your changes to GitHub:

a. You need to add files  —> git add .

(“.” means all the files, no worries, it will add everything that was changed.)

b. You need to Commit you changes –> git commit  -m “Message you want to see near your commit”

c. Push your changes to the server –> git push

My output:

On the repo I now see that README file has my commit message (I changed only README.txt):

 How to get those changes FROM GitHub ?

git checkout

git pull

These commands will bring all the  new stuff from GitHub to your machine.

Good Luck,

Anatoly

4 Responses to “GitHub: How to clone GitHub repo ? How to push to Github? How to get files from GitHub ? (Ubuntu)”

  1. Ian June 15, 2012 at 19:23 #

    “How to clone your repo to your local machine ?

    (in git terminology it’s called “checkout“)”

    No, in git terminology it’s called “clone”.

  2. Technical Analysis Software January 9, 2013 at 01:31 #

    Thanks for your entire work on this web page. My mom delights in going through investigation and it’s really simple to grasp why. Almost all hear all about the dynamic medium you produce invaluable strategies on the blog and even welcome participation from other ones on the concept while our girl is undoubtedly learning a lot of things. Have fun with the remaining portion of the new year. You’re the one conducting a tremendous job.

  3. Dejourne April 22, 2013 at 17:57 #

    Very helpful information, i actually learn something for programing

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 )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 272 other followers