GitHub frequently sees the operation and common mistakes! Bug tip: Fatal:remote origin already exists.

Source: Internet
Author: User
Tags commit manual join ssh using git

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

Tip out the wrong message: Fatal:remote origin already exists.

The solution is as follows:

1. First input $ git remote RM origin

2. Re-enter Git remote add Origin git@github.com:djqiang/gitdemo.git will not be wrong.

3. If input git remote RM origin is still wrong, 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:\Users\ASUS\AppData\Local\GitHub\PortableGit_ca477551eeb4aea0e4ae9fcd3358bd96720bb5c8\ etc

5. Find a file called Gitconfig, and open it and delete it from the [remote Origin] line inside.

If you enter $ ssh-t git@github.com
Bug tip: Permission denied (PublicKey). Because the newly generated key cannot join SSH, it will not connect to GitHub.

The solution is as follows:

1, first input $ ssh-agent, and then input $ ssh-add ~/.ssh/id_key, so you can.

2, if still do not, enter Ssh-add ~/.ssh/id_key command after the report wrong could not open a connection to your authentication agent. The solution is key with Git
GUI of the SSH tool generation, such as the creation of the key is stored directly in SSH, do not need to ssh-add command to join, and other user,token and other configurations are done with the command line.

3, it is best to check the contents of your copy id_rsa.pub file There are no extra space or blank line, some editors will help you add these.

If you enter GIT push Origin master

Tip out the wrong message: error:failed to push som refs to ....

The solution is as follows:

1. First enter the GIT pull Origin master//start the remote server github file

2. Re-enter GIT push Origin master

3. If the report is wrong 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

Using Git to create a project locally

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

Gitconfig configuration file

Git has a tool called Git config, which allows you to get and set configuration variables, which can control the aspects of Git's appearance and operations. These variables can be stored in three different locations:
1./etc/gitconfig file: Contains values that apply to all user and all repositories of the system. If you pass the option "--system" to git config, it will read and write this file correctly.
2.~/.gitconfig files: with your user. You can pass the--global option to make git read or write this particular file.
3. config file in git (i.e.. git/config): Whatever the library you used to be, specific to the single repository. Each level re-writes the previous level value. Therefore, the value in the. Git/config is covered by the same value in the/etc/gitconfig.
In the Windows system, Git looks for the. gitconfig file in the $home catalog (for most people, it is located under C:\Documents and Settings\ $USER). It will also look for/etc/gitconfig, although it is relative to the Msys root of the catalogue. This could be any place you decide to install Git in Windows when you run the installation program.

Configuration information:

2.1 The first thing you need to do when you install Git is to set up your username and e-mail address. This is important because each git commit uses that information. It is permanently embedded in your submission:

$ git config--global user.name "John Doe"

$ git config--global user.email johndoe@example.com

2.2 Your editor (Your editor)

Now that your logo has been set up, you can configure your preset text editor, and Git will use the text editor when you need to enter some messages. In the scenario, Git uses your system's preset editor, which is usually VI or vim. If you want to use a different text editor, such as Emacs, you can do the following:

$ git config--global core.editor emacs

2.3 Check your setup (Checking Your Settings)

If you want to check your setup, you can use the GIT config--list command to list all the settings that git can find at that place:

$ git config--list

You can also view the current value of a specific key that git thinks of, using the following command git config {key}:

$ git config user.name

2.4 Access to help (Getting)

If you need help with Git, there are three ways you can get any git command's manual page (manpage) Help information:

$ git help <verb>

$ git <verb>--help

$ mans git-<verb>

For example, you can run the following command to obtain a manual page for the config command:

$ git help config

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.