Home > Article > Development Tools > How to upload a local project on GitHub
GitHub is an essential development platform for programmers and developers. It not only provides the world's largest open source code repository, but also provides version control tools, project management and collaboration capabilities. In order to manage projects on GitHub, we need to learn how to upload local projects to GitHub. The following will introduce you how to upload local projects on GitHub.
1. Create a GitHub account and install Git
To upload local projects to GitHub, you must first create a GitHub account and install Git. GitHub accounts can be registered for free. Git is a version control system that helps us upload local projects to GitHub.
2. Create a new repository
Create a repository in your GitHub account. The repository here refers to your project repository, which can save your code, documents, pictures, etc. In the repository, we can create different branches and merge different branches, manage and control project versions and updates, and continuously improve and optimize the project.
3. Create a project locally
First, you need to create a project on your local computer. This project can be created by yourself or someone else’s, as long as you want to upload it to Just on GitHub. In a local project, you need to first create a .git file. This file is used by Git to track the version control information of files and folders. We can create a .git file in a local project through the following command:
$ git init
4. Associate the local project with the GitHub repository
In the local project, you need to associate it with the repository you created on GitHub. You need to find the "Clone or download" button in the GitHub repository and click it to get the URL of the GitHub repository. In the local project, enter the following command to associate the GitHub repository with the local project:
$ git remote add origin [GitHub repository的URL]
5. Upload the local project to GitHub
After completing the writing and modification of the code in the local project, prepare Upload the code to GitHub:
$ git add .
Note: "." means added is all files, you can add individual files using specific file names.
$ git commit -m "提交描述"
Note: "Submission Description" is the description information of this submission, which can be written Indicate the modifications or new content submitted this time.
$ git push -u origin master
Note: "master" is the name of the master branch, you can Use a different name, depending on the name of the branch you created.
Summary
This article briefly introduces how to upload local projects to GitHub repository, including creating a GitHub account, installing Git, creating repository, creating projects locally, associating local projects with GitHub and Upload local projects to GitHub. Once you learn to upload projects on GitHub, you can better manage and share your projects.
The above is the detailed content of How to upload a local project on GitHub. For more information, please follow other related articles on the PHP Chinese website!