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.
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
That is going to do it for this post! Leave any comments/questions/concerns below and thanks for stopping by the blog!
YtEmLBkXKC
bghDkWKzoiCaNEI
I used to be more than happy to search out this net-site.I wanted to thanks in your time for this glorious read!! I definitely having fun with every little little bit of it and I have you bookmarked to take a look at new stuff you blog post.
Perfectly written subject matter, appreciate it for entropy. “Life is God’s novel. Let him write it.” by Isaac Bashevis Singer.
I got what you intend,saved to bookmarks, very nice web site.
Yesterday, whkle I wwas aat work, myy cousin stole my iphone aand tested too seee if it caan survive a twenty fivge foot drop, juust soo she can be
a youtube sensation. My apple ipzd iis nnow brokesn aand
she has 83 views. I know thhis is tktally off topic buut I hadd tto share it woth someone!
Heeya i’m for thee first tiime here. Ifouund this board
aand I find It eally useful & it helped mee outt a lot.
I hoe tto givve somethinbg bacfk and aid otherts like you aide me.
Goodd info. Lucfky me I ran acrooss yourr site bby
accient (stumbleupon). I’ve book-marked it foor later!