Establishment of GitHub warehouse and push of local warehouse

Source: Internet
Author: User

First, the establishment of the GitHub warehouse

1. Go to the GitHub website (https://github.com/) and login to the account
2. Click on the "+new repository" control in the lower right corner to enter the following interface: 3. After you click the Create Repository control, a new Git repository is created after clicking the relevant information in the input. Second, the establishment of local warehouses
    • Configure user Information
git config--global user.name "KWGQJJ"
git config--global user.email [email protected]
Third, the establishment of public key
    • First make sure you have a public key.
The
SSH public key is stored by default in the directory under the account's home directory ~/.ssh . The key is to see if there is something something.pub a pair of files to use and to name, this something is usually id_dsa or id_rsa . .pubthe file with the suffix is the public key, and the other file is the key. If you do not have these files, or simply .ssh do not have a directory, you need to create a public key.
    • Ssh-keygen command to create a public key
    • Adding a public key to GitHub
The
page that joins the public key in GitHub is as follows:

Iv. Push the local warehouse to the GitHub Warehouse v. Common error resolution during installation
    • 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 the installation path of your GitHub, mine is C:\Users\ASUS\AppData\Local\GitHub\PortableGit_ca477551eeb4aea0 E4ae9fcd3358bd96720bb5c8\etc 5, find a file named Gitconfig, open it to the inside of the [remote "origin"]那一行Just erase 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 solution is key with the Git GUI    SSH tool generation, so that the generation of key is stored directly in SSH, do not need to Ssh-add command added, 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 the GIT push origin master prompt error message: error:failed to push som refs to .... There are several workarounds:

      1. Use the force Push method:

      $ Git push-u origin master-f

      This will make remote modification lost, is generally undesirable, especially when multi-person collaborative development.

      Remote repository modification pull down before 2.push

      $ Git pull Origin Master

      $ Git push-u Origin Master

      3. If you do not want to merge remote and local modifications, you can create a new branch first:

      $ git branch [name]

      Then push

      $ Git push-u origin [name]

Establishment of GitHub warehouse and push of local warehouse

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.