How to add a local project to GitHub

Source: Internet
Author: User
Tags ssh email account
How to add a local project to GitHub 1. System Environmentubuntu14.04 2. The system generates a key that interacts with GitHub (skip this step if you have already established a connection with GitHub)
$ cd ~/.ssh/
$ ssh-keygen-t rsa-c "own github email account"

Next, enter it all the way down and generate the SSH key.
3. Create a new config file in the. SSH directory and add the following (skip this step if you have already established a connection with GitHub)
    Host github.com
    User git
    Hostname ssh.github.com
    preferredauthentications publickey
    identityfile ~/ . Ssh/id_rsa
    Port 443
4. Add ~/.ssh/id_rsa.pug content on GitHub (misappropriation reference [1]) (Skip this step if you have already established a connection with GitHub)

5. Create a new project on GitHub, in my case, link to git@github.com:jacknb/account-email.git 6. Enter the local project directory to execute the following statement
Git init
git Add.
git status
git commit-am "init"
git remote rm origin
git remote add Origin Git@github.com:jacknb/account-ema Il.git
git fetch
git rebase origin/master
git push Origin master


This will successfully add the local project to GitHub. Note: (1) The SSH key needs to be added to GitHub. (2) You must create the project first on GitHub, or you will get an error. (Many online did not say first created, so in git push times Wrong) (3) Git push times wrong, execute git fetch,git rebase origin/master statement.
Reference:http://www.cnblogs.com/hess/p/6093620.html

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.