This is the quick start guid for Git and Git hub.
Git is a version control system that is used by virtually all open
source (and other large) projects.
This quick start guide shows how to download and install a Git client,
how to create a Github account, and how to get permissions for an
existing Github project (like this one!).
Instructions for installing a Git client are
here .
Once you’ve created your account you can check your user name by
selecting the icon in the upper right corner and then selecting “Your
Profile” (select the link at the bottom of the screen to skip the
tutorial first).
Your user name should be on the left side of the screen.
Login to Github with the account you would like to use for this work.
Navigate to the project you want to edit, in this case https://github.com/OHDSI/DatabaseOnSpark.
Select the “Fork” drop down and then select “Create a new fork” as shown
below.
“Cloning” the repository just means pulling a copy of the files down to
your local machine in a way that any changes you make can be merged back
into the repository.
Open a cmd prompt and navigate to the directory where you would like the
project to live.
After you’ve install the client you will need to issue the following two
commands (this is usually a one time thing).
git config –global user.email “the-email-you-registered-withc@yourhost.com”
git
config –global user.name “YOUR_USERNAME”
To clone the repository, enter the command:
git clone
<paste-repository-name-here>
Change to the directory that was downloaded from the clone
process.
Make your updates to the files.
When you are done with your updates, commit the changes using the
following Git commands.
git add -A
git commit -m “a
very useful and meaningful message”
git push origin
The first time you try to push your updates you will be asked for a username and a password. Your username/password will not work as github has moved to only allowing token based authentication for this activity. To get a token follow the Create Token instructions. Then use your username for the username and the token for the password. Note that pasting the token in as the password can be a little tricky as the cmd prompt does not change when you do the paste. I find the best way to do this is to click the top border of the cmd window to set the focus to that window. Then, right click in the window (this does the paste). Then, press enter.
After the first time you authenticate to the server the git client
saves your credentials. This way you do not have to re-authenticate
every time you would like to push new changes to the server. To change
the user that git uses to authenticate is a little tricky. You need to
open “Credential Manager” (search under windows).
Then select the Windows option.
Then scroll to the git:https://github.com entry and select remove.
The next time you try to push code to the server you will be
asked to enter your username/password (which is really
username/token).
After your (or any) pull request has been accepted your fork will
have a link indicating that you are behind the original (source)
repository. (e.g. the link “1 commit behind” in the screen shot below).
To get your repository upto date, do NOT click on the link. Click on the
“Sync Fork” button shown in the screen shot below.
The run “git pull” on your local host.