From Omnia
Jump to navigation Jump to search


GitHub · Build software better, together. -

"GitHub · Build software better, together."

Global setup:

Download and install Git
 git config --global "Your Name"
 git config --global
 Add your public key

Next steps:

 mkdir test
 cd test
 git init
 touch README
 git add README
 git commit -m 'first commit'
 git remote add origin
 git push origin master

Existing Git Repo?

 cd existing_git_repo
 git remote add origin
 git push origin master

Caching Password

authentication - Git push requires username and password - Stack Overflow -

The following command will save your password in memory for sometime. (For git 1.7.10 or newer.)

# Set git to use the credential memory cache
$ git config --global credential.helper cache
# Set the cache to timeout after 1 hour (setting is in seconds)
$ git config --global credential.helper 'cache --timeout=3600'


See Git

GitHub Flavored Markdown

See GitHub/GitHub Flavored Markdown

GitHub Gist

Gist is a simple way to share snippets and pastes with others. All gists are Git repositories, so they are automatically versioned, forkable and usable from Git.

GitHub Pages

"Websites for you and your projects, hosted directly from your GitHub repository."

GitHub Pages -

Supports static HTML content

Warning: GitHub Pages sites are publicly available on the internet, even if their repositories are private. If you have sensitive data in your Page repository, you may want to remove it before publishing.

User Pages

Only one set of User/Organization pages are available per account. (Although multiple project pages are allowed)

User/Organization Site: (must live in master branch)

  1. On GitHub and create a new repository named (where username is your username (or organization name) on GitHub).
    • Note: If the first part of the repository doesn’t exactly match your username, it won’t work, so make sure to get it right.
  2. Clone repo
  3. Add index.html
    • cd ; echo "Hello World" > index.html
  4. Push it
    • git add --all ; git commit -m "Initial commit" ; git push -u origin master
  5. Browse to new site: (may have to wait a few minutes for the pages to be generated by GitHub)

Project Pages

Project pages work similar to User Pages, but each project can have their own set of Project Pages.

To setup Project Pages, simply create a branch called gh-pages

# Creates our branch, without any parents (it's an orphan!)
git checkout --orphan gh-pages

# Remove all files from the old working tree
git rm -rf .
echo "My Page" > index.html
git add index.html
git commit -a -m "First pages commit"
git push origin gh-pages

Browse to: http://<username><projectname>

Custom URL

Setup a custom URL [1]

--- DNS ---

Create a CNAME on your sub domain name to point to [2] [3]

If pointing an apex domain level, point A record to the following IP addresses: [4]

If your DNS provider supports it, you can also have your apex domain name use an Alias (ANAME) record to point to

If you also create a www subdomain CNAME, GitHub will also respect this too. [5]

--- GitHub CNAME file ---

CNAME file: [6]

If you're using a custom domain to redirect your GitHub Pages site, you must create and commit a CNAME file to your GitHub Pages repository that contains the custom domain.

In the "Branches" menu, switch to your repository's Pages branch:

  • For User and Organization Pages sites, the Pages branch is master.
  • For Project Pages sites, the Pages branch is gh-pages.

In the new file, add a single line that specifies the bare subdomain for your custom domain. For example, use, not Note that there can only be one domain in the CNAME file.

Verify the change by looking under the project's settings, under "GitHub Pages".

Note, the Project Pages site inherits the domain set for its owner's User Pages site, but can be overridden with it's own Custom URL.

Automatic Page Generation

Automatic Page Generation [7] - You can use GitHub's Automatic Page Generator to quickly create a website for a project, user, or organization.

  1. Go to the repository's settings page.
  2. Click the Automatic Page Generator button.

GitHub Pages Disk Quota

"Rule of thumb: 1GB per repository, 100MB per file" [8]

Sync Forked Repo

Configure remote for fork: [9]

git remote -v
git remote add upstream

Sync fork: [10]

git fetch upstream
git checkout master
git merge upstream/master

Fix Author Email


git filter-branch -f --env-filter '
CORRECT_NAME="Your Correct Name"
' --tag-name-filter cat -- --branches --tags
  1. Modify and Run script
  2. git push --force --tags origin 'refs/heads/*'

Changing author info - User Documentation -


https authentication


$ git push
error: The requested URL returned error: 403 Forbidden while accessing

fatal: HTTP request failed


  • Use SSH keys and git:// protocol
  • Add username:password to origin url in .git/config:
[remote "origin"]
        fetch = +refs/heads/*:refs/remotes/origin/*
        url = https://[GITUSER]:[GITPASSWORD]