2018-4-25-- 2. Install the git plugin in sublime3 and connect to GitHub

1. Configure global parameters

The main configuration of Git includes user name, mailbox settings, and the generation of SSH keys and public keys.

First run the following command to set your own user information when git submits code.

2. When using in sublime3, you need to configure the push.default parameter.

Manual configuration to default value:

git config --global push.default matching

Generate SSH Key

Go to the start menu and find "Git Bash", run it, and execute the following commands:

ssh-keygen -t rsa

 

The program will prompt you to enter the file name of the key, such as github and press Enter.
You will then be asked to enter a passphrase, which you will need to provide when using the key in the future. You can enter it, or you can enter it directly without entering it (whether you enter it or not, you will be asked to confirm it once).
After confirmation, the program will generate a pair of keys and store them in the following folders:

C:\Users\Administrator[replace with your username]\.ssh

The key is divided into two files, a private key (github_rsa) and a public key (github_rsa.pub).
The private key is stored on your computer, and the public key is added to the server by the project leader. Users must have a private key paired with the server's public key to access the codebase on the server.

 

3. Bind your own git settings to GitHub.

Find SSH Keys in Settings and click the New SSH Key button

 

You can find all the text in github.pub under the location of the C drive, and click "ADD Key" to complete the addition of the SSH Key public key on GitHub.

 

After clicking the Add SSH Key button, enter my previous password.

4. Install the git plugin in Sublime Text 3

Use the Package Control component (recommended), after opening the install package console, enter git directly to see

Ctrl+shift+P

 Enter git and select as follows:

5. At this time, Sublime Text just installed the git plug-in, but cannot use the git command yet. It is necessary to modify the configuration file "Git.sublime-settings" of Sublimt Text for git, as shown in the following figure to configure this file:

Add the following to this file

{
"git_command": "D:/Program Files/Git/cmd/git.exe"
}

Points to the git.exe file in your git program.

 6. Use the Git plugin in Sublime Text3.

First open the project directory you want to use git to synchronize in Sublime text, mine is "E:\wangjian\Demo\git\sc".

 Then use "Ctrl+Shift+p" to open the command window and enter "Git:init" to initialize the git environment. Sublime Text3 will let you select the Git directory that needs to be initialized, just select it to your project directory.

Use Git:status to see the current status. If there are file changes, a pop-up window will display the change status of the local project. As shown below:

 

 

 7. Use other git:add commands in Sublime text3 to add modified files

 8. Use the git:commit command to submit the modified file. After using the command, the COMMIT_EDITMSG file will pop up, add a note, and after the file is closed, it will be automatically submitted.

9. Failed to use git:push in sublime, so use git command to submit.

gti push -u origin master

 

 

 10. Or use the menu bar in sublime to operate git commands

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324846223&siteId=291194637