Uploading local code to GitHub

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.