First step: Try to create an SSH key
SSH-KEYGEN-T rsa-c [email protected]
The default is to generate Id_rsa and id_rsa.pub in the ~/.ssh directory.
-T represents the key type, common types are RSA1 (SSH-1) ,RSA (SSH-2),DSA (SSH-2), etc., and if not specified, the RSA key for SSH-2 is generated by default.
-C means to provide a new comment
The second step: in the background of github.com add ssh key,title write freely, copy the SSH text string by the following command:
Pbcopy < ~/.ssh/id_rsa.pub
Step three: Verify that the connection is valid
ssh-t [email protected]
the explanation for-T is Disable pseudo-tty allocation. do not occupy the shell. (" It is important to do SSH test connection with-t, because some server could abort the transaction entirely if a T Ext-terminal (TTY) is requested. ")
If this is the first time the connection will prompt for continue, enter Yes to see: You' ve successfully authenticated, and GitHub does not Provide shell access . This means that you have successfully connected to GitHub.
Fourth step: Building a new warehouse in github.com (Repository)
Follow the form to fill in the appropriate content. After the warehouse is established, the page will prompt some basic operation instructions:
Here are some common operations and points of note:
- Get (Pull)
$cd current directory $git init$git pull [email protected]:xxx/xxx.git
Submit (Push)
$cd Current directory $git init$git Add. or git add test.txt$git commit-m "First commit"$git remote add alias [email protected]:xxxxx/xxxxx.git$g It push alias Master
show Local branch when you enter "Git branch" (local branches)
$ git branchdebianserver* Master
- Show Remote Trace Branch (local branches) when you enter "Git branch-r"
$ git branch-rcognac/masterfruitfly/serverorigin/albertorigin/Antorigin /contriborigin/cross-compile
Submit Multiple Files
$git Add file1.txt$git add file2.txt$git add file3.txt$git commit -M "add 3 files. "
- Submit after modifying a file
" Modify File1 " $git push alias Master
$git Commit-a-A is to turn Unstaged's file into staged (this does not include the new (untracked) file) and commit.
Basic configuration and use of GitHub