Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of installing and setting up Git Environment in Sublime Text3

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you how to install Sublime Text3 to build Git environment, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Git installation

Let me remind you that some students like to use the GitHub client, which comes with its own Git version, which is usually found in the string / cmd/git.exe related to the installation directory / GitHub/PortableGit_ version.

It is important to note that this git is not suitable for global use as a machine, because as the GitHub is updated, the string of characters behind the directory file will change, resulting in the invalidation of the previous Git configuration.

It is recommended to download the latest version directly from the Git official website. After installation, add the installation directory / cmd/git.exe to the system environment variable Path, and open cmd and enter git-- version command to check whether the installation is successful.

Git configuration

Configure global parameters

User name, mailbox and SSH are mainly configured here.

# configure user name git config-- global user.name "username" # configure mailbox git config-- global user.email "username@email.com" # generate ssh. After typing, you can hit ssh-keygen-t rsa three times in a row

At this time, check to see if there is a .ssh folder under the user directory of the system disk (usually in C:\ Users\ your user name\ .ssh), and you will see the id_rsa and id_rsa.pub generated before.

Connect GitHub

This is not necessarily GitHub, according to the actual situation of students to connect to different servers, such as OSChina's code cloud.

Let's take GitHub as an example

Add to the SSH and GPG keys column of the settings page, Title can be customized, and the content of Key is the content of the previously generated id_rsa.pub file (just copy it in)

Open the git bash window

$ssh git@github.comPTY allocation request failed on channel 0Hi stephencode! You've successfully authenticated, but GitHub does not provide shell access.Connection to github.com closed.

OK, has been able to connect to GitHub.

Install the Git plug-in on Sublime Text 3

Here I assume that Sublime Text 3 already has Package Control installed and how other plug-ins will be installed through this plug-in.

After opening Package Control, search for git and enter. After installation, open the menu bar Preferences/Package Settings/Git/Settings-User.

Enter the following code and save it

{"git_command": "git installation directory\\ Git\ cmd\\ git.exe"}

At this point, the Git environment has been almost built.

Actual combat

Scene description

One day I saw that my classmate Github maintained a good open source project (test) and wanted to join us to contribute to the project. It just happened to find that the project has not yet added README.md, so copy its code locally and create a new README.md locally, and finally update it to the remote repository (for simplicity, do not consider branches)

Clone the project to local

Visit the main test page of the project and copy its ssh address

In the local git bash window

Git clone git@github.com:stephencode/test.git create and submit your download directory

Open the project with Sublime Text 3 and create a new README.md in the project root directory

Ctrl + Shift + P bring up the command panel, enter ga, select Git::Add Current File, and submit the README.md file to the staging area

Ctrl + Shift + P bring up the command panel, enter gc, select Git::Commit, and submit the README.md file to the version library. At this time, the file submitting the log will pop up. Enter the content and purpose of this update on the first line, and close the file.

Ctrl + Shift + P brings up the command panel, enters gp, selects Git::Push, and submits the README.md file to the remote version library. In the background panel, you can also see that it has been successfully synchronized to the remote repository.

The above is all the contents of this article "how to install and build Git Environment in Sublime Text3". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report