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

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

Thanks for installing the Bottom of every post plugin by Corey Salzano. Contact me if you need custom WordPress plugins or website design.

Anatoly Spektor

IT Consultant with 6 years experience in Software Development and IT Leadership. Participated in such projects as Eclipse IDE, Big Blue Button, Toronto 2015 Panam Games.

Join the Discussion

Your email address will not be published. Required fields are marked *

Discussion

  1. Ian

    “How to clone your repo to your local machine ?

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

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

    1. Slick McApple

      He said clone. And people say checkout. Stick to the subject. And that was a really old comment 😀

  2. Dejourne

    Very helpful information, i actually learn something for programing

  3. Vexxhost Servers

    Woah! I’m really loving the template/theme of this site.
    It’s simple, yet effective. A lot of times it’s hard to get that “perfect balance” between superb usability and
    appearance. I must say you’ve done a fantastic job with this.
    Also, the blog loads extremely fast for me on Opera.
    Outstanding Blog!

    1. Anatoly Spektor

      I am glad you like it!

      Anatoly

  4. Eugenia

    Hi there, I would like to subscribe forг this website to take hottest updates,
    thus where can i do it please help out.

    1. Anatoly Spektor

      Hey Eugenia,

      Thanks for the interest in my blog – you can subscribe by clicking “Follow Me” in the right sidebar.

      Cheers,

      Anatoly

  5. Kris

    Heya i’m for the first time here. I came across this board
    and I find It truly useful & it helped me out a lot.
    I hope to give something back and aid others like you helped me.

  6. Chandra

    My programmer is trying to convince me to move to .net
    from PHP. I have always disliked the idea because
    of the expenses. But he’s tryiong none the less.

    I’ve been using WordPress on a variety of websites for about a year and
    am concerned about switching to another platform. I have heard fantastic things
    about blogengine.net. Is there a way I can import all my wordpress posts into it?
    Any help would be greatly appreciated!

  7. vin

    thank man it works!!!

  8. Wendy

    Thank you!! This was the only set of directions that has made any sense to me concerning GitHub!

  9. hops@fluts.nl

    This is not working …. git push tells me there is no git directory.

  10. Yo

    Excellent !! Thank you !!

arrow