is essentially the process of remote synchronization between a local warehouse and a remote repositoryI. Creating a local warehouse1.CD to your local project root directory, execute git command, git init2. Add all the files of the project to the repository, git add-a If you want to add a specific file, simply replace -A with a specific filename3. Commit the Add file to the repository, git commit at this point, the local warehouse machine has been done! two. Create a remote repositoryas for how to create a remote repository, do not repeat! You can associate an existing local repository with it, and then push the contents of the local repository to the GitHub repository. Three. Association1. Run the command under the local repository: once added, the name of the remote Library is origin, which is the default term for git, or it can be changed to something else, but the name of origin is known as the remote repository. 2. Before uploading to GitHub, pull first and execute the following command: 3. Upload code to github remote repository pushing the contents of the local library to the remote, using the git push command, is actually pushing the current branch master to the remote. Since the remote library is empty, when we first push the master branch, with the-u parameter, git will not only push the local master branch content to the remote new Master branch, but also associate the local master branch with the remote Master branch. You can simplify the command at a later push or pull. Once the push is successful, you can see the remote library's content on the GitHub page immediately as if it were local:from now on, as long as the local commits, you can pass the command: By pushing the latest changes to the local master branch to GitHub, you now have a truly distributed repository!
Uploading local code to GitHub