github submit a remote repository error git remote add orgin

Reprinted from https://www.cnblogs.com/liuzhipenglove/p/7070472.html

 If you enter $  Git  Remote the Add Origin  [email protected]: djqiang (GitHub account name) / gitdemo (project name) .git 

    Tip error message: fatal: remote origin already exists.

    Solution is as follows:

    1, first enter the $  git  Remote RM Origin

    2, then enter the Add Remote Origin git $  [email protected]: djqiang / gitdemo.git  would not have given up!

    3, if you enter $ git remote rm origin is still being given anything, error:. Could not remove config section 'remote.origin' We need to modify the contents of the file gitconfig

    4, find the installation path of your github, I 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"]那一行deleted just fine!

 

 

    If you enter ssh -T $  [email protected]
    error message appears:. Permission denied (publickey) because the new generation can not join the ssh key will cause the connection not on github.

    Solution is as follows:

    1, to enter $ ssh-agent, then enter $ ssh-add ~ / .ssh / id_key, thus it.

    2, or if not, then input ssh-add ~ / .ssh / id_key given Could not open a connection to your authentication agent after the command. The solution is key generation Git Gui of ssh tools, thus generated when key directly ssh are stored in, and do not need the added ssh-add command, the other user, token, etc. are arranged to do with the command line.

    3, it is best to check there are no extra spaces or blank lines when you copy the contents of id_rsa.pub file, some editors will help you add these.

 

 

    If you enter $ git push origin master

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

    Solution is as follows:

    1, first enter the $ git pull origin master // first pull down the remote file server github above

    2, then enter the $ git push origin master

    3. If the fatal error occurs: Could not 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 will need to re-enter the Add Remote Origin git $ [email protected]: djqiang / gitdemo.git

 

 

    Create a project using git in the local process

    $ Makdir ~ / hello-world // create a world-project the Hello
    $ cd ~ / // open the Hello-world project
    $ git init // initialize 
    $ Touch README
    $ git // update the Add README README file
    $ git commit -m 'first commit' // submit updated information and comment "First the commit" 
    $ git the Add remote Origin  [email protected]: defnngj / the Hello-world.git      // connect to a remote github project  
    $ git push -u origin master // will local project updates to github project up

 

   

    gitconfig profile

         Git has a tool is called git config, which allows you to get and set configuration variables; these variables can control various aspects of the appearance and operation of Git. These variables can be stored in three different positions: 
         1./etc/gitconfig file: contains for all users and all database system value. If you pass a parameter option '--system' to git config, it will be clear to read and write this file. 
         2. ~ / .gitconfig file: Specific to your user. You can make Git read or write this particular file by passing --global option.
         3. git directory located in the config file (that is, .git / config): No matter what your current library is in use, the specific point that a single library. Each level rewrite the previous level of value. Thus, the value in .git / config covers the same value in the / etc / gitconfig in.
        On Windows systems, Git find .gitconfig file $ HOME directory (for most people, is located in C: \ Documents and Settings \ under $ USER). It will also look / etc / gitconfig, even though it is relative to the root directory of Msys. This could be anywhere when you decide to install Git run the installation program in Windows.

 

        Configuration information:

        2.1 When you install the Git first thing to do is to set your user name and e-mail address. This is very important because every Git will use the information submitted. It is forever 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, your logo has been set, you can configure your default text editor, Git when you need to enter some messages using the text editor. By default, Git uses the default editor of your system, it may often be 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 Git can be found where :

  $ git config --list

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

  $ git config user.name

 

      2.4 Get help (Getting help)

  If you are using when you need help Git, there are three ways to obtain any git command manual page (manpage) help :

  $ git help <verb>

  $ git <verb> --help

  $ man git-<verb>

  For example, you can run the following command to get the manual page for help config command :

  $ git help config

Guess you like

Origin www.cnblogs.com/whitemouseV2-0/p/12657575.html