Upload GitHub Code

Source: Internet
Author: User

GitHub's own understanding of how to use

Groping for a half-day, even check to find Baidu Google really cost a lot of effort ah, but this tutorial on the web to see really confused ah, a lot of it is affixed to the past, but still help me a lot, more or less understand a bit, the following said in my repeated test many times (many times), Just build a library library on GitHub there should be six or seven, and finally understand, here to write down, hoping to help the first contact with friends.

The simplest direct usage, the most basic to GitHub on the registered account, build the library, this operation is not known, on GitHub on the mouse point on the line, but to remind you to build a library on GitHub in addition to input library name other than the selection is not moving and so on GitHub detection (in fact, the detection has the same library name) And then the submit button below (green) can be clicked, so there is a benefit that you build an empty library, after the establishment of a good library GITHUB will automatically turn to the library page you just built, then you will see the following two GITHUB-provided commands, the two commands is to teach you how to submit code .

Now can be in the computer command terminal (WINDOWS is cmd,linux is called command Terminal how to open shortcut keys you should know) in the operation, the simplest way is not to go to the local configuration of this configuration that.

In the command terminal

First: First use means that the code in this folder you haven't submitted code to GitHub yet.

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

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

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)

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

Git remote Add origin https://github.com/test/testt.git//Here say two places origin this is equivalent to the individual name you can write your own, you can also be written in the name of the current folder, the following address is you in Githu B just new library address, you built a few libraries, you go to GitHub to find your built library point in to see the corresponding address.

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.

Second: Let's talk about how to update 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.

Okay, so that's the way to submit your own code using GitHub. You can extrapolate yourself to think, other more features we'll dig it out for ourselves.

Two official commands available on GITHUB after creating a new empty vault

Create a new repository on the command line
//这是在你要本机的文件夹中新建文件的命令 git initgit add README.mdgit commit -m "first commit" git remote add origin https://github.com/xxxxx/xxxx.git git push -u origin master
Push an existing repository from the command line
git remote add origin https://github.com/xxxxx/xxxxx.git git push -u origin master

Upload GitHub Code

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.