Appendix B: Using Github
In this appendix, we will learn to:
Create a Github account
Create a local repository on our local machine
Update the Github account with the local repository created on our machine
e first step is to create an account in Github. So, visit the https://githu b.com/ URL
to sign up for an account. Because we will be managing our Github repository through our
Windows-based PC, let us download Github for Windows from http://windows.github.
com/. Double-click the downloaded executable file and follow the wizard to install Github on
our computer. Click the GitHub shortcut to launch it. e first screen that pops up is the login
screen to the Github account. Enter the Github ID and password that we used when we created
an account on the Github site (see Figure B.1a). Upon successful login, we get a screen as shown
Figure B.1 (a) Logging into a Github account. (b) The page showing information of the local
and Github repository.
276 ◾  Appendix B: Using Github
in Figure B.1b. We can see that the figure indicates that there is neither any local repository nor
any repository on Github’s account. So, let us create a local repository by clicking the +add link
shown on the top.
We get a page that asks for the information for the new local repository. We enter the title and
a small description of the new repository. e page will show the location on our disk drive where
the newly created local repository will be stored. Check the Push to github checkbox because
we will be pushing or uploading the local repository into our Github account later. e Github
account to which the local repository is associated will also be displayed. Figure B.2a shows that
the local repository will be pushed to the bmharwani account on Github. After entering the
information of the new local repository, click the Create button to create the local repository at
the specified location on the disk. e newly created local repository appears in the local sec-
tion. e name bmharwani/PhoneGapApps that is assigned to the local repository indicates
that PhoneGapApps is the repository created for the bmharwani account (see Figure B.2b).
In the repository titled bmharwani/PhoneGapApps, when we hover the mouse over the
right arrow, the following text will appear, open this repo. Click on the right arrow to open
the newly created local repository, PhoneGapApps. Upon opening the local repository, we find
that two files, .gitattributes and .gitignore, are automatically created for us by default,
as shown in Figure B.3.
Figure B.2 (a) Entering information of a new local repository. (b) The newly created local
repository appears in the local section.
Appendix B: Using Github ◾  277
To copy files of our application into the local repository, we need to open the repository in the
file explorer. So, select the tools icon at the top and select the open in explorer option
from the drop-down menu that pops up. To the repository folder, copy the files of the application
that we want to upload on the PhoneGap Build service, as shown in Figure B.4a. e figure shows
that we copied three files in the local repository: index.html, config.xml, and icon.png.
e three application files copied into the repository folder will then appear in our local reposi-
tory, bmharwani/PhoneGapApps, as shown in Figure B.4b. All the files appear to be in the
uncommitted state. In order to save the changes, the files need to be committed. In the dialog
on the right side, we need to enter a title or small description to identify the commit action and
click the COMMIT button at the bottom of the dialog. e title that is assigned to the commit
action is used to identify it and cancel the commit operation, if required.
After clicking the COMMIT button, there is one more step to make the changes made to the
local repository permanent. e commits made at the moment are entitled unsynced com-
mits. Below the heading unsynced commits, we will see text showing some ID along
with the text Saving the three files, as shown in Figure B.5. Click the text Saving
Figure B.3 The new repository with two default files, .gitattributes and .gitig nore.
Figure B.4 (a) Copying the files of an app into the local repository using file explorer. (b) The
copied files appear in the local repository with “uncommitted changes.
Figure B.5 The page informing us that the commits made are in the “unsynced commits” state.

Get PhoneGap Build now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.