Upload local code to github

Uploading code to github can be done in the form of command line and client. The principle is the same.

Step 1: Create a git repository 
cd to your local project root directory and execute the git command

git init

Step 2: Add all files of the project to the repository

git add  .

If you want to add a specific file, just replace . with a specific file name

Step 3: Commit the add file to the repository

git commit -m "comment statement"

Step 4: Go to github to create your own Repository, and create a page as shown below: 
write picture description here

Click on Create repository below, you will enter a page similar to the following, and get the https address of the created repository. The red box indicates the
write picture description here

Step 5: The point is here, associate the local repository to github

git remote add origin https://github.com/hanhailong/CustomRatingBar

Replace the following https link address with your own warehouse url address, which is the address marked in the red box above

Step 6: Before uploading to github, pull it first and execute the following command:

git pull origin master

After hitting enter, the output will be similar to the following 
write picture description here

The seventh step, which is the last step, upload the code to the github remote repository

git push -u origin master

After the execution, if there is no exception, the upload will be successful after the execution is completed. You may be asked to enter the Username and Password in the middle. You only need to enter the github account and password.

Guess you like

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