[Go]github Detailed tutorial

Source: Internet
Author: User
Tags hosting hosting sites web hosting to domain git commands git shell ruby on rails

GitHub detailed

GitHub is a shared web hosting service that holds software code and content items that use Git version control. It was written by the developer Chris Wanstrath, PJ Hyett and Tom Preston-werner of GitHub (formerly known as logical Awesome) using Ruby on Rails.
GitHub also offers a paid account and a free account for open source projects. According to a GIT user survey in 2009, GitHub is the most popular git access site. In addition to allowing individuals and organizations to create and access code libraries, it also provides a number of features that facilitate social software development, including allowing users to track the dynamics of other users, organizations, repositories, and commenting on software code changes and bugs. GitHub also provides charting capabilities to show how developers are working on the code base and how active the software is.
GitHub also offers a paste-style site gist, a wiki for use by the software code base, and web hosting that can be edited and managed through the GIT repository.

I. Registration

Log in to Https://github.com,

Follow the steps to register. Generally choose free, the uploaded code will be public, pay can not be publicly managed code.

Two Modify User Name

Sometimes we need to modify the username (username is very important), login https://github.com/, click into Personal settings, click, such as:

Click Change username to modify the user name.

Three Install GitHub for Windows

Https://github.com the bottom of the home page,

Four Create a new repository, managed code on GitHub

A repository (warehouse) can put a project. We create a new local repository with GitHub for Windows software.

1. We know the software before we start the new. open GitHub for Windows, login to your registered account, the leftmost is the local warehouse, the middle is each updated commit comment, the right side is the warehouse code, you can view each modification and add.

2. We click on the upper Right side , first set the software

Open the options, set the clone path according to your own situation, is also the default location of the new repository local repository, and we will build the repository in the Location folder. You can also set congfigure git, other default. Such as:

3. Back to the main screen, click on the software above , create a new repository

As we can see, the new warehouse is in the default location folder and the warehouse name is the folder.

Note:

? Name does not allow words to have spaces, it is recommended to connect with "-".

? Local path is your default address +name; Of course, we can also click Browse to select the location of the repository.

? Git ignore ignores certain files, and projects often generate files that do not require tracking (track) in the Git system. Typical is the file generated during the build process or the temporary backup file generated by the programmer. General default.

Click on Create respository, we can see the following interface:

. Gitattibutes and. Gitignore are generated by default. The local warehouse has been built successfully.

We'll sync the local repository to the remote repository by clicking on the Publish respository on the top right.

Add description, description of the warehouse.

After a successful release, the Publish respository icon changes to sync, which means it's synced.

If there is no code for the new warehouse location, we need to copy the code in, right click on the Front-end-engineer warehouse,

Note:

? View on GitHub is a remote repository that opens a Web page, called Front-end-engineer.

? The Open in GIt Shell is a command that opens. You can learn git commands, and this article does not introduce GIT commands at this stage.

? Remove is the removal of the local repository. However, remote repositories do not affect, only local changes are no longer updated remote libraries.

Click Open in Explore, go to the Front-end-engineer Local repository folder, and copy the project code to the local repository. (Of course, if you choose the code location as the warehouse above you do not need to copy the code.) )

We'll go back to Windows for GitHub and see the uncommit changes in the middle column, and each time the local code update will produce a uncommit changes,

We need comments, commit commits to synchronize changes to the local repository to the remote repository. Specific practices:

Click Show,

At this point we can see that the rightmost column already has the code we added, then fill in the Summary (update summary) and description (updated description), and finally click on Commit to Master (Master is the main branch, the general default), You can synchronize the updates to the remote repository.

Finally, we also add readme.md to the warehouse project to illustrate the project or program.

4.readme.md Edit

Two ways to add: a landing https://github.com/, Select the warehouse where you want to add readme.md, add readme.md to the remote warehouse, and edit online to preview the effect, and then use the editor (such as Sublime) to add readme.md locally and then sync to the remote repository.

If you already have readme.md, we can click in the remote repository file directory and choose to make changes.

README.MD is not written casually, it has a specific syntax.

① about the title

? Big headline
====

Add the equals sign below the text, and the text above becomes a big headline. The number of equals is unlimited, but must be greater than 0.

? in the title
-------

Underline the text below-the text above becomes the middle title, and the same number of underscores is unlimited.

In addition, the title also has a hierarchical notation, divided into six levels, the text size of the display decreases in turn. The number of pound # is identified between different levels. The first level title has a #, level two heading has two #, and so on.

#一级标题

# #二级标题

# # #三级标题

# # #四级标题

# # # #五级标题

##### #六级标题

The effect is as follows:

In fact, the headlines and titles described above correspond to the headings of the first level and the level two headings respectively. Three to six levels do not have the following horizontal line.

② display text

To display a hyperlink, enter the URL of the link directly

To add a hyperlink to a text format: [text to be displayed] (the link's address "hover-displayed word"). Hover-displayed word is optional.

? insert a dot, add * to the text, note that there is a space after the asterisk *. Otherwise, it is displayed as a normal asterisk. There are also two-level dots and three-point dots. is to add a tab. The second line is a tab, and the third row is two tab.

③ inserting pictures

? The first method:! [] (the address of the image link "hover-displayed word"). Hover-displayed word is optional.

? The second method: a picture from the GitHub repository (this method is recommended, and other source URLs are likely to expire).

The premise is that your remote repository has pictures, the address format of the image link is as follows:

https://github.com/your username/your project name/raw/branch name/the folder where the picture is stored/picture under this folder

Where raw indicates the meaning of the original data; Master Branch master. General default.

④ inserting code

We need to mark the last line and the next line of code with a ' '. The first line can be added to the language, highlighting the code. "is not three single quotes, but the number 1 to the left, TAB key above the key. Examples are as follows:

"Ruby
Require ' Redcarpet '
Markdown = Redcarpet.new ("Hello world!")
Puts markdown.to_html
```

If you want to highlight some of the text in a paragraph, play a prominent role, and you can surround it with '.

⑤ inserting tables

| First Header | Second Header |
| ------------- | ------------- |
| Content Cell | Content Cell |
| Content Cell | Content Cell |

⑥ above basic enough, not the use of HTML tags.

Markdown supports most HTML text editing tags. such as line break, with <br> and so on. But markdown some labels are much simpler to write. Attached: HTML tags supported by markdown.

Five Modify settings for an existing warehouse

Login to https://github.com/, click on the user name and go to the contributions page

Click on the repository you want to set,

Click Settings in the lower right corner to set up warehouses, such as deleting warehouses

Six Find the code you want on GitHub and save it to your local repository

1. Login to https://github.com/, in the Search box, enter the keyword search

2. Find the project you are interested in, click Fork, and save someone else's project to your remote repository.

In GitHub, developers can host their own project source code, but also watch (focus), Star (asterisking), Fork (copy), pull request (submit question or request function) Other developers of the project.

Fork: Cloning someone else's code base into your own project, can be used as a submodule, or two times development. Click the Fork button in the open source project and a moment later, the item will be copied to your respositories.

3. In GitHub for Windows, clone the remote Fork's repository to local , click, enter clone,

4. Of course, you can download the project or code directly on the Web page. To save someone else's project code in your own warehouse, use the method above.

Seven Create an organization

Establish an organization, invite members, co-develop and share.

Build on https://github.com/, click on, New organization,

Enter the page to establish the organization, naming rules with the warehouse name naming rules.

After completion, can invite members, can be built for organization repository and so on. Click the user name to enter the user center, in the lower left corner,

Click on your organization to build repository,invite someone for organization.

Eight Building Websites with Githut

The types supported by the GitHub hosting project are user/organization pages and project pages, two of the basic types supported on the two github hosting sites.

User/organization Pages
This is a two-level domain name that GitHub assigns to each account, but it's important to note that you must start with your username or you won't be able to access it.
Project Pages
In addition to the above-mentioned warehouses named after their own names, the others are built as Project Pages. However, to achieve access to the page, you need to create a gh-pages branch to access it.

We build websites with user/organization pages

1. Build the Jingwhale.github.io warehouse with GitHub for Windows and don't repeat it here. Build site, User/organization Pages personal or company site construction warehouse name must be used username or Organization. The steps for building a warehouse refer to part four.

2. Login https://github.com , enter the built Jingwhale.github.io warehouse, click Settings, then you can see the domain name you want to build the site Http://jingwhale.github.io, find automatic page Generator

Click to go to the page to see the jump:

Project Name: website title; Tagline: Website subtitle; Body: This is the source of the Web page.

Click "Continue to Layouts", select the theme, then publish

Now you can access your home page on your Github.io, for example: http://jingwhale.github.io/.

Note: http://jingwhale.github.io/If not open, 404, can wait 30 minutes or so, or repeat the above steps, republish.

3. Sync your website to GitHub

Clone your own Username.github.io (such as Jingwhale.github.io) remote repository to local, copy the Web page you have developed into the local repository of the clone and synchronize to the remote repository, and then visit HTTP/ jingwhale.github.io/, is to visit your own written website. (Note that index.html is the home page.)

4. Bind your domain name to github pages

① Adding a CNAME file

Login to https://github.com/, add a Cnam file in the root of the Username.github.io repository, no suffix name, the contents of your domain name (such as: test.com), do not need to add http/www and other prefixes.

② Record the IP address

In https://github.com/, click Help, go to the help page, and in the search box DNS, find the tips for configuring A record with your DNS provider. Queries the IP address (192.30.252.153 or 192.30.252.154) that configures the domain name resolution record to the associated GitHub. Someone also pings Username.github.io to get an IP address.

③ Configuring a record

Login to your domain management interface. Create an A record that points to the IP address of 192.30.252.153 or 192.30.252.154.

④ Verify that the domain name is successfully associated with GitHub.

Visit the interface once with GitHub's link, and then visit the interface once with the domain name, the interface is the same as the two are looking at.

Note:

? If the domain name cannot be accessed immediately, wait for a period of time to revisit it.

When GitHub is successfully linked to a domain name, it is accessed as a link to GitHub, which is automatically converted to domain name access.

Finish

Reproduced must be reproduced in the words, the original author and the original post address.

[Go]github Detailed tutorial

Related Article

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.