How to upload your local code to a GitHub backup

Source: Internet
Author: User
Tags git shell

This article is written using the method under Windows.

First step: Create a new GitHub account

Step Two: Create a new warehouse

Step three: Fill in the name, Introduction (optional), tick initialize this repository with a readme option, which is automatically created Reamde.md file, save you to create again.

Fourth step: Install GitHub Shell program, address: http://windows.github.com/

Fifth step: Open the Git Shell and enter the following command to generate the key to verify the identity

Ssh-keygen-c ' [email protected] '-t RSA

The pub file is generated under the. SSH folder under the User of window, and all the contents of the Id_rsa.pub file under the folder are copied. Then open the GitHub account settings, find the setting inside the SSH keys, the upper right corner click on Add SSH key, and then enter the title at random, key bar paste just the key.

Sixth step: Enter the command under GIT shell to test if the public key is properly authenticated.
ssh-t [email protected]
warning:permanently added ' github.com,207.97.227.239 ' (RSA) to the list of known hosts.
Hi flowerowl! You've successfully authenticated, but GitHub does not provide shell access.
Warning don't bother.

Seventh Step: Clone the newly created repository to local, enter the command:
git clone https://github.com/Flowerowl/stumansys.git

Eighth step: Upload your local code to GitHub
First, first use means that the code in this folder you have not submitted code to GitHub (the folder name of the upload code should be the same as the repository name on GitHub.) )

(1) Cd/home/test (if test is your user name)/githubtest (this is a folder, you can first set up in advance, this folder can also be the project folder you want to submit code)

(2) Git init//This is initialized to create an empty library in this folder

(3) git Add. This command you can directly git Add. This is to add all the files in the current folder to the uploaded list (note that there is a space), you can also added specific files git add files you want to add (test/test/test.txt)

(4) Git commit-m "description"//This note with your own discretion (note to add double quotation marks), but also note that this command is best to write this, the article on the web said that only with git commit this is not the case can be such a command system will automatically use a default application The program opens a file for you to enter a description, but if the system does not open by default, then you can not continue to carry out, anyway, is to write instructions, it is not a few words, suggest that you directly write the order, province to their own trouble

(5) Git Remote add origin https://github.com/test/testt.git//Here say two places of origin this is equivalent to the individual name you can write your own, or can be written in the name of the current folder, the following address is you in the GI Thub the newly created library address, which libraries you have built, you can see the corresponding address when you go to GitHub to find the repository point you built.
If an error occurs:
Fatal:remote origin already exists
The following statement is executed:
Git remote RM origin
(6) Git push-u origin master//starts uploading and then prompts you to enter the username and password that you registered on GitHub and then wait to upload it.

Nineth step: Let's talk about updating the code.

Cd/home/test (if test is your user name)/githubtest (this folder is the project folder where you want to submit the code, if you have already used the first method)

git Add. or add specific files to git add files you want to add (test/test/test.txt)

git commit-m "description"

Git push-u origin master//Do you remember this alias? origin is the alias you used to submit your code to GitHub for the first time.

How to upload your local code to a GitHub backup

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.