Brief git push step

Source: Internet
Author: User
brief git push step 1. Git init

Create a new warehouse, create a new folder, open, and then execute

Git init 2. Create a local warehouse

Using the command "Git remote Add Origin git@github.com:yourname/yourrepo.git", Youname is your github username

Git remote add Origin git@github.com:yourname/yourrepo.git

s if the "fatal: Remote origin already exists" error is found, execute the following instructions before executing the instructions above

Git remote RM Origin 3. Add Files

For example, to add a file xxx to the local repository, use the command "git add xxx" and use "git Add." Automatically determine which files to add, add all modified or new files

git Add. 4. Submission of Changes

Git commit-m "code submission Information" 5. Push Changes

Now your changes are now in the head of the local warehouse. Execute the following command to submit the changes to the remote repository

Git push Origin Master

If the following error occurs
tip: The update was rejected because the remote repository contains a commit that does not yet exist locally. This is usually because the other
Tip: A warehouse has been pushed to the reference. You may need to consolidate the remote changes before pushing again

You can try two ways: 1 get a remote update and merge with the local, and then git push

Git remote add Origin https://github.com/username/Hello-World.git
gitfetchorigin//get remote update GIT fetch ORIGIN//Get remote update git merge origin/master//merge updated content to local branch 2) forcibly update via +master

Git push-u origin +master

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.