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