Upload existing code to github using Git

Source: Internet
Author: User
Tags ssh using git

1. Use your existing GitHub account to create a project on it. After entering the GitHub website, in the lower right corner, there is a green button called New Repository, click to create a GitHub project.


2, then is to fill in some relevant information. Just fill in your own thoughts.


3. Create SSH Key

Under Shell, enter the following command.

Ssh-keygen-c ' your@email.address '-t RSA
Confirm that you use the default path, and then enter the password twice if you use it (usually directly knock a few returns without using a password)


4. Submit Secret Key

Now go back to the GitHub page and find account Settings in the toolbar on the top right. On this page there is an SSH keys tab, select Add SSH key. The title is literally taken, key is the beginning of the creation of a thing. Locate the Id_rsa.pub file (typically in the user's home directory), open it to see a bunch of text, copy it and paste it into the space on the GitHub page key. Then apply, just fine.


You can test the connection using the following command

Ssh-v git@github.com

5. Upload Code

The last thing to do is upload your code ~ Bash switches to your project directory and enter the following command.

Git remote add origin git@github.com: Your github user name/your github project name. Git
git push origin master
Now go to http://github.com/your GitHub user name/your github project to see your project ~ Good luck

Of course this is from scratch, if you have a git repo that you want to add to GitHub, then just use the 8th Step command (don't forget the key work). So many beginners should be like me, in the initial confusion git and github relationship, Git is and cvs,svn side of a concept, and GitHub is and Google Code, sourceforge a parallel concept, in specific point, Git is a code-management tool, and GitHub is a code-hosting platform, so that's clear. So, git's learning words, see here.

Reference: Git/github The use of the method of small notes

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.