Intellj IDEA uploads code to GitHub

The first step is to have a GitHub account. After successful registration, click Start a project on the home page of your personal homepage, as shown in the figure:

Next, in the interface for creating a code repository, enter the name of the repository you want to create, and choose whether to make the code public or private. Because it is Java code, choose Java when selecting the .gitignore file, and choose Apache License 2.0 for the open source protocol, and click Create repository The codebase can be created as follows:

The choice of different open source protocols can refer to the picture drawn by Ruan Yifeng:

After the code base is created, Git needs to be downloaded on the computer before the local code is synchronized with GitHub. Here I choose Git for Windows from the GitHub team. The download URL is: https://gitforwindows.org/

In addition to the installation path, when downloading and installing, you can set the next default all the way. After installation, click the File menu of IntelljIDEA, then click the Settings option, enter the dialog box and click the Git option under the Version Control drop-down triangle, in the Path to Git executable one In the bar, select the path of Git installed on your computer, as shown below:

Then click on the GitHub column, select Password for Auth Type in the upper right corner, log in with a password, enter your GitHub account and password, and click OK, as shown below:

Then click on the GitHub column, select Password for Auth Type in the upper right corner, log in with a password, enter your GitHub account and password, and click OK, as shown below:

After setting, go back to the repository page created by yourself on GitHub, click the Clone or download button on the right, the address of the remote code repository will be displayed, click the copy button to the right of the address to copy the address, as shown below:

Then, use Git bash or the cd command of the command line to move to the directory of the project you want to upload. Here I am directly using the command line terminal of IntelljIDEA, because the command line of the current project has been located in the root directory of the current project by default. , use git clone plus the URL of the remote library copied by yourself, and synchronize the certificate and other files of the remote library to the current project, as shown below:

After importing the remote file successfully, enter the root directory of the current project, and you will find an additional folder with the same name as the code base on GitHub. After entering, the hidden project will be displayed, and there will be an additional hidden . The files and folders are copied to the upper directory, which is the root directory of the project, as follows:

After copying, you can delete the folder originally imported from GitHub with the same name as the remote library, and then use the git add . command on the command line or Git Bash to add all files to version control first, as follows:

But before formally submitting to the Git local library on the computer, you need to use the two commands git config --global user.email "[email protected]" and git config --global user.name "someone" to configure the user of the local library After the email address and user name are configured, the git commit -m "some description" command can be formally used to submit the code to the local library, as shown below:

Finally, synchronize the code submitted to the local repository to the GitHub remote repository, using the git push origin maste r command, as follows:

After the synchronization is successful, refresh the GitHub remote library page and see that the code has indeed been synchronized, as shown below:

Guess you like

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