git uploaded folder notes, git common commands, git common bugs

Source: Internet
Author: User
Tags using git


First step: Build Git Warehouse
CD to your local project root directory, execute git command

Git init11

Step Two: Add all the files from the project to the warehouse

git Add. 11

If you want to add a particular file, just replace it with a specific file name.

Step three: Commit the Add file to the warehouse

git commit-m "comment statement" 11

Fourth step: To create your own repository on the GitHub, create the page as shown in the following image:

Click the following create Repository, you will enter a page similar to the following, get the HTTPS address of the warehouse created, the red box is marked

Fifth step: The emphasis is on, the local warehouse is associated to the GitHub

Git remote add Origin Https://github.com/hanhailong/CustomRatingBar11

The following HTTPS link address is replaced with your own warehouse URL address, which is the address of the red box above

Sixth step: Before uploading the GitHub, must first pull, executes the following command:

Git pull Origin Master11

When you hit enter, the output is similar to the following

The seventh step, the final step, is to upload the code to the GitHub remote warehouse

Git push-u origin Master11

After execution, if there is no exception, wait for execution to upload success, the middle may let you enter username and password, you just enter GitHub account and password on the line

common errors and solutions for git command line Operations

If you enter $ git Remote add Origin Git@github.com:djqiang (GitHub account name)/gitdemo (project name). Git

Prompt error message: Fatal:remote origin already exists.

The solution is as follows:

1. First enter $ git remote RM origin

2, then enter $ git remote add Origin git@github.com:djqiang/gitdemo.git will not be an error.

3, if the input $ git Remote RM origin or error, error:could not remove config section ' Remote.origin '. We need to modify the contents of the Gitconfig file

4, find your GitHub installation path, mine is c:usersasusappdatalocalgithubportablegit_ca477551eeb4aea0e4ae9fcd3358bd96720bb5c8etc

5, find a file named Gitconfig, open it to the inside of [remote "origin"] that line deleted.

If you enter $ ssh-t git@github.com
Error message: Permission denied (PublicKey). Because the newly generated key cannot join SSH, it will cause the connection to be GitHub.

The solution is as follows:

1, enter $ ssh-agent First, then enter $ ssh-add ~/.ssh/id_key, so that's OK.

2, if still not, enter Ssh-add ~/.ssh/id_key command after the error could not open a connection to your agent. Solution is key with git GUI ssh tool Generated, so that when the key is directly saved in SSH, do not need to ssh-add the command to join, and other User,token configuration are done with the command line.

3, it is best to check if you copy the contents of the Id_rsa.pub file has no extra space or blank line, some editors will help you add these.

If you enter $ GIT push origin master

Prompt error message: error:failed to push som refs to ....

The solution is as follows:

1, first enter $ GIT pull origin master//First pull the remote server github the file above

2, then enter $ GIT push origin master

3, if there is an error fatal:couldn ' t find remote ref Master or fatal: ' Origin ' does not appear to be a git repository and fatal:could not Read from remote repository.

4, you need to re-enter $ git remote add origingit@github.com:djqiang/gitdemo.git

The process of creating a project locally using Git

$ makdir ~/hello-world//Create a project Hello-world
$ CD ~/hello-world//Open this project
$ git init//initialization
$ Touch README
$ git Add Readme//Update Readme file
$ git commit-m ' the ' a '//submit update and comment information "A-commit"
$ git Remote add origin git@github.com:defnngj/hello-world.git//connect to a long-distance github project
$ GIT push-u origin master//update local project to GitHub project


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.