git command line configuration
1 Installing GitHub
2 Installing Msysgit
3 To configure the user name and fuel tank
git config--global user.name < username >
My command is: git config--global user.name Mchdbagh
git config--global user.email < tank >
My command is: git config--global [email protected]
4 Verifying that there is no remote server connected
ssh-t [email protected]
5 to generate SSH key
$ ssh-keygen
If you see a password, you can return to the main window with a direct 2 enter.
Go find. SSH inside the id_isa.pub open, it is best to open with notepad++, the contents of the inside copy out, and then put in the https://URL inside, join
See the documentation for more information on how to build. Http://www.worldhello.net/gotgithub/index.html#id6
Git Common Commands Introduction
Git init-initializes the project and uses it when it starts initializing the project
git clone--cloning from the server to the local, if the server already has a project, directly using this command clone to local use.
Git status--view version information
Git add--Add a local file
Git commit--Commit changes
git push--tags--push changes to the server
(1) Git init operation
[HTML]View Plaincopyprint?
- [Email protected] ~
- mkdir Test_git
- [Email protected] ~
- CD test_git/
- [Email protected] ~/test_git
- Ls
- [Email protected] ~/test_git
- $ git init
- Initialized empty Git repository in C:/Documents and settings/skyman/test_git/.git/
- Ls-a
- .. . git
See A. git file
[Plain]View Plaincopyprint?
- $ ls-al
- Total 0
- Drwxr-xr-x 3 Skyman administ 0 Sep 25 23:10.
- Drwxr-xr-x Skyman administ 0 Sep 25 23:10..
- Drwxr-xr-x 1 skyman administ 0 Sep 23:10. git
- $
See more of the other. Git directory, indicating that the project was created successfully.
(2) Git clone operation
Login https://github.com/, look at the bottom right corner, find the URL to open the library to add the hint mchdbagh/manual56 to the back, the URL is https://github.com/mchdbagh/manual56
After opening, click the Copy button below the HTTPS clone URL column in the lower right corner to get the clone address https://github.com/mchdbagh/manual56.git of the library.
You can also choose SSH mode: [Email protected]:mchdbagh/manual56.git
git clone [email protected]:mchdbagh/manual56.git;
Open git clone [email protected]:mchdbagh/helloworld.git
If you need to customize a directory name, you can write git clone [email protected]:mchdbagh/helloworld.git TEST_HW
Detect if clone succeeds, see if manual56 directory exists
[Java]View Plaincopyprint?
- $ ls
- AppData Favorites NTUSER. DAT SendTo _viminfo manual56 WC
- Application Data iecompatcache nethood Templates admovie.jpg Ntuser.dat.LOG??????????????????
- CMB ietldcache printhood UserData client.log ntuser.ini??????
- Contacts Local Settings privacie VirtualBox VMs Extensions Ntuserdirect_mymanager.dat
- Cookies My Documents recent WINDOWS HelloWorld test_git
(3) GIT add operation experiment
[Plain]View Plaincopyprint?
- $ CD manual56/
- --View the status of git current repository
- $ git status
- # on Branch Master
- Nothing-to-commit (working directory clean)
- --Go to the chapter directory I want to edit
- $ CD docs/chapter_17/
- $ vim 17.5.0.0.0.md--Create a new MD file, which simply writes "Only a Test" string, Wq save exit Edit state.
- --View status
- $ git status
- # on Branch Master
- # untracked Files:
- # (use "git add <file> ..." to include in what'll be committed)
- #
- # 17.5.0.0.0.MD--See a new file with red color has not been submitted, the name of this line is shown in red.
- Nothing added to commits but untracked files present (use "Git add" to track)
Adding files Add
Git add 17.5.0.0.0.md adds a single file, multiple files can be separated by spaces, such as (git add 17.5.0.0.0.md 17.5.0.0.1.md 17.5.0.0.2.md), or you can use Git add-a to add all the files.
[JavaScript]View Plaincopyprint?
- --Execute Add command
- $ git Add 17.5.0.0.0.md
- --View individual file version status
- $ git status 17.5.0.0.0.md
- # on Branch Master
- # Changes to be committed:
- # (use "git reset HEAD <file> ..." to Unstage)
- #
- # New FILE:17.5.0.0.0.MD
- #
- --View the entire library version status
- $ git status
- # on Branch Master
- # Changes to be committed:
- # (use "git reset HEAD <file> ..." to Unstage)
- #
- # New FILE:17.5.0.0.0.MD
- #
Manually open C:\Documents and settings\skyman\manual56\docs\chapter_17\17.5.0.0.0.md with Markdownpad, enter the Chinese string inside, save exit. Then check the repository status, show the green color of the expression has been cached, the red color is modified but not cached.
[HTML]View Plaincopyprint?
(4) Git commit, after the modification, commit to commit git commit-m "Test change",-M is the specified submission information, required items
[HTML]View Plaincopyprint?
- $ git commit-am "Test chanage"
- [Master 3e96f90] Test Chanage
- 1 file changed, 1 insertion (+), 1 deletion (-)
- $ git status
- # on Branch Master
- # Your Branch is ahead of ' Origin/master ' by 2 commits.
- #
- Nothing-to-commit (working directory clean)
- --Display has been submitted to the local repository
(5) Push the modified file to the server, git push--tags --push so cache the file to the local server.
[HTML]View Plaincopyprint?
- $ GIT push origin master
- Counting objects:13, done.
- Delta compression using up to 2 threads.
- Compressing objects:100% (8/8), done.
- Writing objects:100% (10/10), 768 bytes, done.
- Total (delta 6), reused 0 (Delta 0)
- to [email protected]:mchdbagh/manual56.git
- E754e68. 3e96f90 Master-> Master
OK success, and then open the URL https://github.com/xxxxxx/blob/master/docs/Chapter_17/17.5.0.0.0.md to see the new content submitted, see the picture shows, The newly created file 17.5.0.0.0.md has been successfully uploaded to the remote file server.
These projects, if they are individual projects, are sufficient to meet our daily use requirements, but if more people work together, that is not enough.
Git learning--personal frequently used commands add,commit and push