preface
Hello everyone, I am Bai Mo, a love of learning and swimming contradiction.
When I first encountered collaborative development, I was at a loss. SVN? Git? What the hell is that?
Our tutor asked us to use SVN to understand it, and it was not convenient at all. We had to use a computer as a server for submitting codes for group projects among classmates, and we had to penetrate the Intranet. It’s too much trouble.
Someone else recommended me to use The code cloud, I tried it, it really smells good! So I specially compiled a tutorial, convenient for people like me who have never touched Git and need to use it.
GitHub connects to IDEA in much the same way.
Download and install Git
1. Go to the git official website and select your operating system
Download from git-scm.com/downloads
2. Select the corresponding version to download according to your system bit
The system bits are generally 64 bits.
Forget it, don’t bother to read, directly download 32 bits! No problem, no problem!
If you want to see it, but don’t know where to see it, you can click here.
By the way, if there is a problem with the network download is slow, you can pay attention to my public number “Bai Mo is a program ape” send “git” to get files, as well as “Git official Chinese manual” PDF e-book.
3. The installation
Open the exe file you downloaded.
** Next ** is the easiest way to do this, so there is no need to cover complicated options.
Remember your installation directory during installation. The default directory is C:\Program Files.
4. Configure a global user name and email address
After the installation, configure the user name and email address. You have to have an identity when you submit code to someone else’s repository, right? That’s what it does. Use your registered Gitee email address.
Go to the system menu in the lower left corner, find Git Bash, and click Open.
Type the following code and press Enter to change the user name and email address in quotes to your own.
git config --global user.name "Username"
git config --global user.email "Email"
Copy the code
If you have not configured the user name and email address, the following window will pop up later, you can also configure:
5. Configure the Git directory in idea
1. Click the File TAB of IDEA and select Setting to open the Setting
2. Select Git under Version Control. 3. Go to bin–>git.exe in your Git installation directory and click OK
5. Click “Test”, the version number will appear successfully.
Configure the Gitee plug-in
Make preparations in advance: Code cloud account (gitee.com/) 1. Click the File TAB of IDEA and select Setting to open the Setting
2. Install the official code cloud plug-in Gitee
2.1 Select Plugins, type gitee in the search box, and click “Search in Repositories” to search the repository
2.2 Select Gitee installation in the search results
2.3 Click restart IDEA after the installation is complete
3. Configure the Gitee API token
3.1 open the Settings page and select “Gitee” under Version Control. 3.2 click “Create API token” on the right. 3.3 in the Login dialog box that is displayed, enter the Login name and password and click “Login” to Login
Note that this user name is not your mobile phone number or email address, but the user name on your cloud personal page
3.4 Check whether the Login is successful
Clone and upload project
Cloning project
- Find the project address on code Cloud or GitHub, a project hosting site: Open the project and click on the”
cloning
“And copy the project address
- Select the”
File
“- >”New
“- >”Project from Version Control
“- >”Git
“
- In the”
URL
“Enter the address of the project copied in the first step and clickTest
.”Connection successful
“Connection successful, in”Directory
“Select save address and click”Clone
“
- Waiting for cloning. Open the project and you’re done.
Upload the project
1. Open the Project and choose VCS > Import into Version Control > Share Project on Gitee
2. Enter the project name “New Repository Name” and the project Description “Description”, select private, and click “Share” to upload
3. When this window pops up for the first time, enter your code cloud account password
4. After the success of idea prompt, open the code cloud can see the project you share
4. Update the project
After completing one of these steps, whether uploading or downloading, it is easier to update and pull projects for collaborative development.
Push your own updates
1. After the code changes, click “VCS” on the toolbar –> “Commit…” Or the green tick (any of the following)
2. Check the information and click Commit (the layout of the latest version of IDEA has been changed -2021.06.23)
3. If you have a warning, you can view it. If you don’t want to view it, just “Commit” it.
4. The submission is successful. Note: There is a difference between commit and push. The commit step does not update the code to the server!
You can Commit multiple entries.
5. Push to server, click “VCS” –> “Git” –> “Push..”
Push results:
Pull updates from colleagues
Pull the update before each code change to avoid code conflicts.
1. On the toolbar, click “VCS” –> “Update Project…” Or the little blue arrow pointing to the bottom left (either way below)
2. Use the default options and click OK to update.
3. Check the prompt in the lower right corner. Since the project here is the same as that on the server, the prompt “all files are the latest version” is displayed.
Afterword.
Well, that’s the end of this article! This article has been written for a long time. At that time, I had a little knowledge of Git. This tutorial is enough for Xiao Bai and there is no problem.
Git also has a lot to learn, such as the use of code cloning, push, code conflict solution, if you have time or suggest to go to the system to learn, related courses b station has.
I am Bai Mo, a contradiction between learning and paddling. A new blog just began to write, the quality of the future will be higher and higher, welcome to witness! Why don’t you click on it? Why don’t you click on it? Click follow
Remember, (゚▽゚) Blue public number “White ink is a program ape”, come in and stroll