The Linux command line commits an existing project to GitHub

Source: Internet
Author: User
Tags using git

Before using Git in Windows with the Git graphical interface to operate, this time a small project written for several days to commit to Git, the Linux command line below the graphical interface, so all need git command to operate.

After practice, it is mainly the following steps:

(1) Log on to GitHub and create a repo project

(2) Run git init under your project project directory

(3) Then add all the required code and configuration below the project to git, command:git add *.cpp *.h CMakeLists.txt(add as you want)

(4) then run git commit-m "log message (own commit log)", note here must add-M, plus commit the log, otherwise the commit is not successful, in the subsequent push operation will prompt the error: "Error:src Refspec Master does not match any. "The main thing is to waste more time in this step.

(5) then run git remote add Origin https://github.com/lovemychobits/minihttpd.git, add Origin on GitHub

(6) Finally submit the code we specified, command:git push-u Origin master, then git will prompt you to enter your github above the user name and password, and then go to a file upload interface, upload completed the end.

After a few simple steps above, you can submit your existing project to GitHub. In fact, when I created an empty project on GitHub, there was a more detailed hint of the steps on GitHub's Web page, but I didn't pay much attention to wasting a bit of time at first, and there was no-m additional information at the time of the commit.

Before git push, if you want to know what you are committing or modifying, you can use Git status to see it. In addition, if add, some of the folders you do not want, or files, you can use the Git rm-rf folder, and git rm file to delete, the difference is to delete the folder needs to add-RF. The deletion folder here refers to the deletion of the commit to git, not the deletion of the local OH.

This is the simple use of the git command line.

  

The Linux command line commits an existing project 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.