Tuesday, March 25, 2014

Learning - using GitHub's Client App (for Windows)

Yo,

So, in my last post I just kept running into all kinds of issues with trying to use EGit to create a quick Java Project and push up to my GitHub (on my Windows 7). Today, we try a different approach. Let's go through the client app created by GitHub @ http://windows.github.com/

Before I go through these instructions by GitHub, I still have the following set paths:
  • My GitHub Java Rep:  https://github.com/gradney/Java.git
  • My Git root folder:  C:/Users/gradney/git
    • only thing in this folder is my global core.excludes file:  .gitignore
  • My Workspace folder:  C:/Users/gradney/workspace/Git
    • Although I still use Eclipse, I am not using EGit (i.e. Git plug-in for Eclipse).
I downloaded the "GitHub for Windows" client app. We'll call this GitHub Client. When I clicked on "create" for creating a new repository, I noticed this Client was trying to store my new repos in a new default path as "C:/Users/gradney/Documents/GitHub". Let's change this, in the Client's "tools", to what my git uses:
  1. Updated default GitHub folder to:  "C:\Users\gradney\git"
  2. Updated default shell to:  Git Bash
Instead of creating a local repository, let's sign into GitHub via this Client. I'm officially logged in, but I don't see any difference. I create a new repo:
  1. Name:  HeadFirstJava
  2. Description:  Projects created while learning from Head First Java.
  3. Path:  C:\Users\gradney\git\HeadFirstJava
  4. Push to GitHub:  True (checked)
  5. Keep this code private:  False (unchecked)
  6. Account:  gradney (checked)
Click Create, and I get this nice little window for confirmation. I open this repo and see initial files.



I also see this repo (i.e. HeadFirstJava) created via Windows Explorer.


I go into my HeadFirstJava folder via the Windows Explorer.


Yes, we are making progress! And I see it's already in my GitHub, yes!!!

Okay, what next? Well, let's open the .gitignore file to see its content. Oh great! GitHub already added all the files that should NOT be uploaded into GitHub. Whew, thanks a lot GitHub folk!!!

So, maybe I can create a Java Project with Eclipse now. Before I do, let's add a Summary, Description for Uncommitted changes, and then "Commit changes" in the GitHub Client. Nice, we have "Unsynced commits" which is a good sign. Next, click on "publish" in the GitHub Client first and see what happens.



Yes! I also clicked on "sync" in making sure everything was sync'd. And, my files are committed online as we can see! I'm feeling really good now (especially after all the trouble I had yesterday and this morning).



Oh, let's add the README file as recommended by GitHub. Online, let's click on "Add a README" button. I'm pretty satisfied with what GitHub added automatically into this README file. I add a quick title and description, and then click on "Commit new file" at the bottom of the webpage.

Here's something interesting: I just added a new file via online in GitHub but I don't have this downloaded to my local Git repo. What do I do (in sync'ing the two)?

Well, this is beautiful - GitHub Client already connects and establishes a claim that our local repo is not in sync with the online repo (i.e. GitHub). The nice little, light blue icon (with the number of updates missing from my local) is displayed next to the "sync" button. All we have to do is click "sync" and our local will sync up with GitHub. This also updates in our Git root folder (C:\Users\gradney\git\HeadFirstJava). Perfect!!!



Now, we can proceed towards the main objective - creating a Java Project to publish to GitHub. Hopefully I can put this up tomorrow. Until then, Peace! :)

No comments:

Post a Comment