Git links to your own GitHub (1) Simple start

Source: Internet
Author: User

For a long time did not come up to get things, today came back to start to get git, and then continue to write Uboot and kernel compilation, under version control more macroscopic to observe each change.

1. Install Git in Ubuntu

$ sudo apt-get install git git-core

2. Configure the native git

$ git config--global user.name "abcd" $ git config--global user.email [email protected]

3. Generate key

$ ssh-keygen-t rsa-c "[email protected]"//Email ditto

4. Submit Key

Vim/home/linx/.ssh/id_rsa.pub//Copy the key inside

Login to your account on the GitHub page, and then setting, find SSH key to copy the key to join (need to enter GitHub password again)

5, check whether the link on GitHub

$ SSH [email protected]//Normally, echo the following Pty allocation request failed on channel 0Hi plinx! You've successfully authenticated, but GitHub does not provide shell access. Connection to github.com closed.

6. First push

$ mkdir tmp      //Create push directory $ cd tmp//         Enter the push directory    $ git init       //Set the directory for push $ touch Readme   //Generate readme$ git add Readme/ /Add Modify list $ git commit-m ' first commit '//submit change statement $ git Remote add origin [email protected]:abcd/tmp.git//rename remote git to origin$ gi T push-u Origin master//push This modification

Then all sorts of questions begin here, and here's how to solve them:

Question one:

Error:repository not found.

The problem is that there is no such repository in the GitHub account you are pushing.

Workaround:

1) Check your github repository, check the directory you created, must be consistent;

2) First git clone under Repository in GitHub, and then make changes, so it must be the same.

Question two:

Agent admitted failure to sign using the key. Permission denied (PublicKey)

This problem is because your SSH key is not added to the SSH key of the GitHub account you want to git, so there is no access right.

Workaround:

1) Re-copy a copy of the current ~/.ssh/id_rsa.pub SSH key to GitHub add;

2) First delete the ~/.ssh/in_rsa* file, then re-ssh-keygen a copy of the Sshkey to generate the key, then copy to GitHub, and then SSH link GitHub to verify the success of the Unicom.

Question three:

The following prompt appears! [Rejected] master, Master (Non-fast-forward) error:failed to push some refs to ...

The problem is that this code is already in GitHub and does not allow you to overwrite it.

Workaround:

1) Forced push, generally not recommended!

$ git push-f

2)

$ git pull

Additional hints will appear, meaning that branch and merge are not specified, and git cannot select the branch to push.

You can modify the following content in the. git/config file by modifying

[branch "master"]    Remote = origin    merge = Refs/heads/master

You can also modify the command line directly

$ git config branch.master.remote origin$ git config branch.master.merge ref/heads/master

The current understanding of these three questions.

After that, you'll be able to push it successfully.

Git links to your own GitHub (1) simple start

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.