Install GitHub (Windows mirroring)
$ git config--global user.name "username"
$ git config--global user.email "[Email protected]"
Create a repository (for git managed files)
$ mkdir learngit Create (folder) directory
$ cd Learngit Move to Directory
$ pwd Show current directory
Initialize the git repository ( by git init
command to turn this directory into Git warehouses that can be managed: )
$ git init
add files to the git two section ( commit
you can submit many files at once, so you can add
different Files )
$ git add <file> Add File
$ git commit–m "caption" submit the action and bring the instructions
Modify the file (update the contents of the file, add and submit again)
$ git status View the current file status of the warehouse (whether modified)
$ git diff <file> have a good tell me, modify the content (you can use the Git status repeatedly to view the file status)
Update with Add file to git two section
Version fallback (view git log, I do not go back to action, log only operation)
$ git log (--pretty=oneline//Show only commit (version number) and action, and display on one line
Commit 46d1db4f3dc8ee7b1905a465071438d0e963cb1d
Author:feng-codeking <[email protected]>//user
Date:sat June 25 08:31:54 2016 +0800//Date
Add distributed//file operation
File deletion
$ RM <file>
Remote Warehouse
Create ssh
$ ssh-keygen–t rsa–c "[email protected]" (Get .ssh
Directory, with id_rsa
and id_rsa.pub
two files, these two are SSH key key pair )
Login to GitHub, open "Account Settings", "SSH Keys" page, fill in any title, paste the contents of the Id_rsa.pub file in the key text box
associating remote libraries
$ git Remote add origin [email protected]:<username>/learngit.git
Push all the contents of the local library to the remote library
$ Git push–u Origin master ( first push plus –u parameter, then push $ git push origin master)
Cloning Remote Libraries
$ git clone [email protected]:<userrname>/<git Library name >.git
The first GitHub experience