Creating a Repository for Our Website



In this post we will be creating a public repository for our website. We will make some updates locally, add, commit, and push our code changes up to the GitHub where the whole world can see it!

Step 1: Create the Repository on GitHub

Once you are logged into GitHub. Click on the “New Repository” button. First, give the repository a name. Then select either “Public” or “Private” depending on who should be able to see this repository. Check the “Initialize with README” checkbox and click “Create Repository”.

Now, on our repository home page, click on the “Clone or Download” button and copy the “Clone with SSH” link.

clone with ssh

Step 2: Command Line Git Commands

1. Open up the command line and use the following command to clone the repository that was just created in step 1. The git clone command will clone everything in our easycodeis repository from GitHub down to our localhost.

git clone git@github.com:jstolpe/easycodeis.git

2. Now, inside of our easycodeis folder run the git status command. This command will tell us how our local folder compares to what is on GitHub.

git status

3. Running “git status” in #2 should have told you everything is up to date. Now, lets add some files to the repository. I am adding an index.php file, css folder, and an assets folder. Once those files have been added inside of my easycodeis folder, I can add them on the command line. This will get them ready to commit.

git add --all

4. Run “git status” again (#3). We see our files are now in green which means they are ready to commit!

5. Commit the files. This will commit the files to our repository, but only locally.

git commit -m "initial code commit"

6. Push the files we have committed up to GitHub! This command is where our committed files in our local repository actually go up to GitHub. All we have to do is run our push command!

git push

Head over to GitHub and check out the repository. It should now be updated with the files we have added, along with our commit message in the commit log. We have successfully setup a repository for our website! A few tips I have would be to run git status, a lot. This way you can quickly check to see if anything locally differs from the repository. Also, run git pull before you begin working. This will make sure you have the latest and greatest code in the repository before starting in on a new feature. If you do not do a git pull before starting a new feature, and there have been many other developers who have committed lots of updates, you are not starting with the most recent, up to date repository. In this case, you run the risk of many merge conflicts when you are ready to commit your code.

Links

YouTube Video

Code on GitHub

That is going to do it for this post! Leave any comments/questions/concerns below and thanks for stopping by the blog!

 

 

14 comments

  1. I am extremely inspirerd wih you writihg skils annd alo with the folrmat iin your
    weblog. Is thiis a paid tueme or did yoou customize it yourself?
    Anyway stray upp thhe nife quality writing, it iss uhcommon too peer a great weblog likle this
    onne tthese days..

  2. Hi, I doo believe this is a great blog. I stumbledupon iit 😉
    I’m goijg to revisit yet again sinche I saved as a favorite it.
    Monedy and freedom is tthe greatwst way too change,
    may you bee rjch and continue too guide others.

  3. Wow, fantastic blog layout! Hoow longg have yyou beewn bloggikng for?
    you mazke blogging glawnce easy. The full glance of yojr siite iss
    wonderful, llet alon the content material!

  4. Normally I do not read article on blogs, however I ould like to saay
    that thuis write-up very prssured mee tto cheeck out andd do it!

    Yourr writing sttle has beedn surprised me. Thanks,
    quiite nice article.

  5. I don’t evenn knbow the waay I ended uup here, however I thougjt
    this ppost wwas good. I doo noot reconise wwho yoou arre however certainly you’re
    ging to a famous blogger wheen you are not already. Cheers!

  6. After explorikng a number of thhe blog posts oon our site, I truly appreciate
    your techbique oof blogging. I savved itt too my bookmark siite list and wil bee checking back in thhe neaar future.
    Please visi my website as wll and tell mee what yyou think.

  7. Greetings! Very useful advice within this article!
    It is the little cchanges which will make thhe mopst significcant changes.
    Thanks a lot for sharing!

  8. Heey there woould yoou mind lettting mme now which hosting company you’re utilizing?

    I’ve lladed your blog in 3 compltely diffeent rowsers andd I muust say thhis blog loads a lot quiicker then most.

    Caan you suggest a good webb hosting progider aat a reasonabhle price?
    Kudos, I apprehiate it!

Leave a Reply

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