How to upload local code to GitHub

I believe that readers already have their own GitHub accounts when they see this article, and have successfully installed git by default, so I won't talk about it here, just start the topic.

Step 1: Create your own repository and copy the https address for later use.





Step 2: Find the project directory you want to upload, right-click "Git Bash Here" to open, and the following interface will appear (my project file name is "Demo").


Step 3: Add the README.md file.

echo "# Test">> README.md

Step 4: Create a git repository.

git init

Step 5: Add all files of the project to the repository.

git add .

Step 6: Add README.md to the repository.

git add README.md

Step 7: Submit to the warehouse (in the quotation marks is the comment statement, which is the description text of this submission).

git commit -m "wrote a readme file"

Step 8: Associate the local repository to GitHub, and change the following https to the address you just copied.

git remote add origin https://github.com/XueLing666/Test.git
Step 9: Upload the code to the GitHub remote repository.
git push -u origin master


Enter your GitHub account name and password. If there is no exception, the upload is successful. At this time, the repository should be updated.


Good! At this point, you have successfully uploaded your project code to GitHub.

Guess you like

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