GitHub

GitHub
GitHub · Build software better, together. - https://github.com/
 * "GitHub · Build software better, together."

Global setup:

Download and install Git git config --global user.name "Your Name" git config --global user.email kiloforce@k.ttak.org 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@github.com:kiloforce/test.git git push origin master

Existing Git Repo?

cd existing_git_repo git remote add origin git@github.com:kiloforce/test.git git push origin master

Caching Password
authentication - Git push requires username and password - Stack Overflow - http://stackoverflow.com/questions/6565357/git-push-requires-username-and-password

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

$ git config --global credential.helper cache
 * 1) Set git to use the credential memory cache

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

Git
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.

https://gist.github.com/

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

GitHub Pages - https://pages.github.com/

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 username.github.io (where username is your username (or organization name) on GitHub).
 * 2) * 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.
 * 3) Clone repo
 * 4) * git clone https://github.com/username/username.github.io
 * 5) Add index.html
 * 6) * cd username.github.io ; echo "Hello World" > index.html
 * 7) Push it
 * 8) * git add --all ; git commit -m "Initial commit" ; git push -u origin master
 * 9) Browse to new site: (may have to wait a few minutes for the pages to be generated by GitHub)
 * 10) * http://username.github.io/

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

git checkout --orphan gh-pages git rm -rf.
 * 1) Creates our branch, without any parents (it's an orphan!)
 * 1) Remove all files from the old working tree

echo "My Page" > index.html git add index.html git commit -a -m "First pages commit" git push origin gh-pages

Browse to: http:// .github.io/

Custom URL
Setup a custom URL

--- DNS ---

Create a CNAME on your sub domain name to point to username.github.io. 

If pointing an apex domain level, point A record to the following IP addresses: 192.30.252.153   192.30.252.154

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

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

--- GitHub CNAME file ---

CNAME file:

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 blog.example.com, not https://blog.example.com. 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 - 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"

Sync Forked Repo
Configure remote for fork: git remote -v git remote add upstream https://github.com/ORIGINAL_OWNER

Sync fork: git fetch upstream git checkout master git merge upstream/master

Fix Author Email

 * 1) !/bin/sh

git filter-branch -f --env-filter ' OLD_EMAIL="your-old-email@example.com" CORRECT_NAME="Your Correct Name" CORRECT_EMAIL="your-correct-email@example.com" if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ] then export GIT_COMMITTER_NAME="$CORRECT_NAME" export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL" fi if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ] then export GIT_AUTHOR_NAME="$CORRECT_NAME" export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL" fi ' --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://help.github.com/articles/changing-author-info/

https authentication
Error: $ git push error: The requested URL returned error: 403 Forbidden while accessing https://github.com/oeey/ksmtp/info/refs

fatal: HTTP request failed

Solutions:
 * 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]@github.com/oeey/ksmtp