Git usage under Linux-put existing projects on GitHub

Source: Internet
Author: User

There is already a project in the local area, need to put the project on GitHub, how to do?

Steps:

Installing git locally is a prerequisite for a GitHub account.

(1) First create an empty warehouse on GitHub and copy the link address. Use HTTPS, the address that ends with. Git.

(2) Initialize the local repository and submit content to local

To open the command line terminal first, then switch to the directory of the project you want to add to GitHub by using the CD command, and then execute the following command in turn, with the following commands and their meanings:

Touch README.MD--Create a description document

Git init--Initialize the local repository

git Add. --Add all the modified files under the current command, prepare commit commits, the command effect is equivalent to Git add-a

git commit-m ' submit instructions '--Submit the modified file to the local repository, e.g. git commit-m ' add readme.md documentation '

Git remote add origin repository address-remote warehouse address, which is the address of your own new warehouse.

Git push-u Origin master-creates an upload stream and pushes local code through this stream to the master branch in the repository that is aliased to Origin

Wait a while and you'll need to enter your password, which is your github login password. It takes a while to upload the first time.

At this point, local projects have been uploaded to GitHub. For subsequent changes to the code submission, only the following actions are required:

git Add. --Add all the modified code to prepare for submission

git commit-m ' submit description '--Submit the modified code to the local repository first

Git pull--if you're collaborating with multiple developers, get pulled first, take GitHub's latest code locally, and avoid conflicts

Git push-pushes the code to GitHub and pushes it to the master branch in the repository that is aliased to Origin by default.

Git usage under Linux-put existing projects on 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.