Use git bash (git command line) to upload local code to github.

Source: Internet
Author: User

Use git bash (git command line) to upload local code to github.

Git command tool Git Bash .?

First, run the cd command in Git Bash to access the corresponding local project path, and follow the command below :?
1. git init indicates the cost-effective git management in the current project directory.

2. git add. indicates the file you want to submit to github. If you want to add all the files, use git add. ". "to add all files in the current directory.

3. git commit-m "first commit" indicates your comments on this submission.

Git commit-m "submitted description information "?
If the-m parameter is not used here, git will tune it to a text Compiler (usually vim) to let you enter the submitted description.

Git commit-a-m "submitted description information "?
The-a option of the git commit command can only submit all modified or deleted documents that have been managed by git to the warehouse. If you only modify or delete the documents that have been managed by Git, you do not need to use the git add command.

Git commit -- amend: For comments that have been modified and submitted, you can use git commit -- amend to modify the comments.

4. git remote add origin

5. git push-u origin master is used to update local branches, push to remote hosts, and enter the user name and password as prompted. -U option specifies a default host. This step may prompt you :?! [Rejected]? ? ? ? Master-> master (fetch first), because the git repository already has content, you need to use the git pull command to synchronize the code first. The steps are as follows: use git pull origin <branch name (default master)> to pull down the server code. If there is no problem, it will be solved. If the message "fatal: refusing to merge unrelated histories" appears, run the following command: git branch -- set-upstream-to = origin/<branch name> master, run git pull origin master -- allow-unrelated-histories to pull down the code and then call git push-u origin master to upload the code.

Note: When you enter the password, it does not respond. Therefore, you must enter the password carefully .?
The upper and lower keys of the keyboard can be selected and executed repeatedly.

 

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.