-
Notifications
You must be signed in to change notification settings - Fork 296
Cheatsheet — Git & GitHub
Note: The tips below are tested under MS Windows.
-
Using HTTPS
With the HTTPS connection you will be prompted for your GutHub credentials when you clone, pull and push.
git clone https://github.com/telerik/ajax-docs.git
-
Using SSH
As for SSH, you should create an SSH key and add it to your GitHub account. More detail are available in this GitHub article—Generating SSH keys.
git clone [email protected]:telerik/ajax-docs.git
Information about that is available in this GitHub article—Generating SSH keys.
If there are complication head to the GitHub troubleshooting article on the matter—Error: Permission denied (publickey).
However, you can follow this steps to generate an SSH key:
-
Generate a file with your ssh key (passphrase is optional, although, recommended):
ssh-keygen -t rsa -C "[email protected]"
-
Add your new key to the ssh-agent:
-
Start ssh agent:
ssh-agent -s
or
eval "ssh-agent -s"
or
eval "$(ssh-agent)"
Tip: On my end, the
eval "ssh-agent -s"
andeval "$(ssh-agent)"
always do the job. -
Add the key to the ssh agent:
The file generated is available in the root folder, where GitBash has been started. Therefore, you need to use this file.
Note: The generated files are two -
[FileName]
and[FileName].pub
.ssh-add [FileName]
or
eval "ssh-add [FileName]"
-
-
Add your ssh key to your GitHUb account:
-
Remember the generated
[FileName].pub
file? Use the following command to copy the ssh key to your clipboard:clip < [FileName].pub
-
Head to your GirHub account;
-
Go to settings
;
-
Go to SSH Keys section;
-
Press the Add SSH key button—
-
A form will appear below, type a title and paste the key in the textarea below:
-
Add the key by using the green Add key button below.
-
-
Test the connection
ssh -T [email protected]
Staging is used to prepare a commit
or a stash
.
-
Staging all changes:
git add -A
or
git add --a
-
Staging a file:
git add filename.ext
Tip: With
Tab
key GitBash will list all files and folders available for staging. -
Staging an entire folder (and all file within):
git add controls/ajax/
- Home
- Getting Started
- Deploying Documentation on IIS
- Git and GitHub Workflow
- Handling Redirects (link to the docs-seed wiki)
- Markdown Syntax (link to the docs-seed wiki)
- Markdown Nesting (link to the docs-seed wiki)
- Using Templates (link to the docs-seed wiki)
- Using Git and Git Bash
- Faster Jekyll Build via generate_exclude.rb Script
- Using Helper Tools
- Troubleshooting
- Use VS Diff tool with Git and SourceTree