Simply use Git and github to manage your own code and book notes

Source: Internet
Author: User
Tags using git

Original link: http://my.oschina.net/bxxfighting/blog/378196

    1. Register Github.com's account first official website: https://github.com/

Registration interface, the first user name, will be used in the future, mine is bxxfighting

2. Login screen

3. Login after successful interface

4. Create a warehouse, I now create a test warehouse called Buxingxing, the warehouse is public and private, public is free, private is charged, I use the public warehouse, the following creation method

Click the New Repository button, pop up the following interface, the first line to fill the warehouse name, called a buxingxing, the second line is the description of the warehouse, then the public is the meaning of the common warehouse, the next readme is in the warehouse to create a readme file, Can write some of the functions of the project to introduce you, and then the next Add Gitignore button, you can choose what language you use this project, and then the license I did not choose, click "Create Repository"

5. After the successful creation of the warehouse, the interface is shown below, you can click Readme.md to compile the file.

Install git under Windows

1. Download URL: http://git-scm.com/download/

2. Download complete, open the installation, click "Next"

3. Click "Next"

4. After you can change the installation path, click "Next", I have not changed, is to use the default path.

5. I have selected all the options here.

6. Direct default, click Next.

7. Default settings, click Next

8. Default settings, click Next.

9. Default settings, click "Next"

Using Git and GitHub to host project code

1. Double click on the icon "Git Bash"

2. Open the interface as follows

3. Configure git, as shown below:

A) First enter ssh-keygen–t rsa–c "e-mail address", note that there is no space between Ssh-keygen, the other is a space between

b) After the carriage return, a line will appear, let you enter a place to save the key, the parentheses inside is its default location, here will let you enter a few times the content, do not enter, directly enter the can, you can see the effect (it is best not to enter, direct return, I first changed the saved path, there is a problem, One less file):

c) After the carriage return, so that the key is generated, you can open id_rsa.pub (location according to your computer) to view, I use the Notepad directly open this file, all of the content is this key, one will need to use, directly select Copy

D) Now go to the GitHub site to configure SSH key, click the arrow to indicate the triangle icon, select Settings, and then click on the left side of the SSH keys, then click on the right of the Add SSH key, this will appear to add SSH key interface, in the title this column Fill in a name, the name is random, and then open the file you just generated id_rsa.pub, select Copy contents to key This column, click the Add Key button to complete the operation, then you fill in the mailbox will receive a confirmation of the mail, do not care about it

e) Verify that the settings are successful and enter the following command under GIT bash:

ssh–t [email protected]

If you are the first time, you will be asked to enter Yes or no, then enter Yes, the other display is the same as mine. If you are not this content, it is possible to display permissions problems or something, it should be the case I mentioned above, you see if you generate the key is the correct operation, the directory under the known_hosts this file

f) Now configure the user name and mailbox:

git config–global user.name "user name"

Git config–global user.email "Mailbox"

4. So far as we've done with git and GitHub, we're going to host our project now, we've created a repository called buxingxing on GitHub, and we're now creating a directory locally to manage the repository.

A) randomly created a directory called Buxx

b) Right-click on the directory and the menu that appears has git Bash here and click on it.

c) Our terminal is opened in this directory at this time.

d) Enter Git init at this time to complete the initialization work. This time there is a. git directory in the directory. Note that in a total of three commands, Init/remote/pull are shown above, the following steps are shown in this picture.

Now continue to enter the following command on the terminal to increase the management of the Buxingxing warehouse created on our GitHub.

git remote add origin [email protected]:bxxfighting/buxingxing.git

Where bxxfighting is the user name that I used when I registered on the website, Buxingxing.git is the name of the warehouse I created for this project, which is shown on the website:

e) Since I created the readme.md at the time of the creation of the warehouse, I have already counted the submission, I need to synchronize the contents of the warehouse locally, the command is as follows:

git pull [email protected]:bxxfighting/buxingxing.git

The finished effect is as follows, and the Readme.md file is more in the local directory

Now we create our files in a local directory, such as the files I created:

f) The next step is to upload the file I just created to the warehouse, first execute the Add command, as follows:

git Add. (This is followed by an English period)

Add after adding a point, is to submit all the files, if you want to submit the specified file, you can write the filename, after executing the increment command, to execute the commit command, as follows:

Git commit–m "write down your own record of this submission"

-m behind with the hint message, this message is must write, not only the rules, but also convenient for us to record the process of submission, write clearly why the submission or modification of what is very useful, after the submission is completed, we will push it to the remote repository, the command is as follows:

git push [email protected]: Bxxfighting/buxingxing.git

So we can do all the tasks we have to do.

Now basically can be used, each time you add a new file to add, and then commit, if you just change the contents of the file, only commit the line, of course, the final step is to execute push, so the change is pushed to our GitHub to host.

Simply use Git and github to manage your own code and book 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.