Upload a local project to the GitHub managed __github using the git command

Source: Internet
Author: User
In this article, I will detail how to upload a project that you have written locally (or a project you are writing) to GitHub for hosting or working with multiple people. The specific steps are as follows:

(1) First in the GitHub on a new repository, I named Newsclient, the other according to their own needs to fill out:


(2) When the creation is complete, you can see that ...


(3) Notice the item URL in the lower right corner, copy it and use it later:


(4) Then I have a project in the local, name for news, terminal into my project directory:

.


(5) Execute command: Git init

The command is to initialize a repository in your project directory, and after successful execution, a. Git hidden file is generated in your directory.

As shown in figure:



(6) Execute command: git Add.

Notice that there is a "." At the back of the command, small dots. Indicates that all files in the directory are added to the local registers. There will be no prompts after the execution succeeds:


(7) Execute command: Git status

This command compares your local workspace with the version of registers to see the current status. My status is that all files have been added to the registers, but not yet submitted to the local history area.


(8) Execute command: Git commit-m "Here is the comment ... "

This command submits the files in the local registers to the local history area, noting that only content in the local history area can be submitted to GitHub. After executing this command, all of our files are only local. There is no github any relationship.




(9) Execute command: Git remote add Origin https://github.com/chenyufeng1991/NewsClient.git

This command adds files from the local history area to the registers of the GitHub server. This step is a step in establishing a connection between local and remote servers. No results will be displayed after successful execution:



(10) Execute command: Git pull Origin Master

The order is to first pull down the documents on the GitHub, and note that the first pull before each submission is to prevent conflicts.


After execution may appear the following interface, actually does not have the tube, the input ": Wq" the Enter key to exit can.


After the success of the above implementation, found in the project directory more than a "readme.md" file, the file is pulled from the GitHub. We created this "readme.md" file when we created repository on the GitHub, which is a description of the repository.


(11) Execute command: Git push-u origin Master

This step is really submitted to the GitHub, after the completion of the GitHub on the repository on the same as your local code file.




(12) came to GitHub under the view, as shown in the picture shows that the upload code succeeded.

.


GitHub home: https://github.com/chenyufeng1991. You are welcome to visit.

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.