Original link: http://blog.csdn.NET/dengjianqiang2011/article/details/9260435
If you enter Git remote add origin [email protected]:d Jqiang (GitHub account name)/gitdemo (project name). Git
Tip error Message: Fatal:remote origin already exists.
The solution is as follows:
1. First enter GIT remote RM origin
2, then enter the GIT remote add Origin [email protected]:d jqiang/gitdemo.git will not error!
3. If you enter GIT remote RM origin or an 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:\Users\ASUS\AppData\Local\GitHub\PortableGit_ca477551eeb4aea0e4ae9fcd3358bd96720bb5c8\ etc
5, find a file named Gitconfig, open it to the inside of the [remote "origin"]那一行
delete it!
If you enter $ ssh-t [email protected]
Error message: Permission denied (PublicKey). Because the newly generated key cannot join SSH, it will cause the connection to not be on GitHub.
The solution is as follows:
1, first enter $ ssh-agent, and then enter $ Ssh-add ~/.ssh/id_key, so you can.
2, if still do not, enter Ssh-add ~/.ssh/id_key command after the error could not open a connection to your authentication agent. The workaround is key with the Git GUI SSH tool Generated, so that when 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 if you copy the contents of the Id_rsa.pub file there is no extra space or blank lines, some editors will help you add these.
If you enter a GIT push origin master
Tip error 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 down
2. Then enter $ GIT push origin master
3. If an error occurs 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 origin[email protected]:d jqiang/gitdemo.git
The process of using Git to create a project locally
$ 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 ' first commit '//submit update and Comment message "First commit"
$ git Remote add origin [email protected]:d efnngj/hello-world.git//Connect remote GitHub Project
$ GIT push-u origin master//update local project to GitHub project
Gitconfig configuration file
Git has a tool called Git config that allows you to get and set configuration variables that control all aspects of Git's look and operation. These variables can be stored in three different locations:
1./etc/gitconfig file: Contains values that apply to all users of the system and to all libraries. If you pass the parameter option '--system ' to git config, it will explicitly read and write this file.
2.~/.gitconfig file: Specific to your users. You can make git read or write this particular file by passing the--global option.
3. config file (i.e.. git/config) in the Git directory: Regardless of what library you are currently using, point to that single library. Each level overrides the value of the previous level. Therefore, the value in. Git/config overrides the same value in the/etc/gitconfig.
In Windows systems, Git looks for. gitconfig files in the $home directory (for most people, under C:\Documents and Settings\ $USER). It will also look for/etc/gitconfig, although it is relative to the Msys root directory. This could be anywhere you decide to install git when you run Setup in Windows.
Configuration related information:
2.1 The first thing to do when you install Git is to set your user name 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 [email protected]
2.2 Your editor (Your editor)
Now that your logo is set, you can configure your default text editor, whichgit will use when you need to enter some messages. By default,git uses your system's default editor, which is usually either 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 settings (Checking Your Settings)
If you want to check your settings, you can use the git config--list command to list all the settings that git can find there :
$ git config--list
You can also look at the current value of a particular keyword that git believes to be, using the following command git config {key}:
$ git config user.name
2.4 Get Assistance (Getting help)
If you need help with Git, there are three ways to get the manual page (manpage) help for any git command:
$ git help <verb>
$ git <verb>--help
$ mans git-<verb>
For example, you can run the following command to get the manual pages Help for the config command :
$ git help config
git to go