Using the Ruby on Rails architecture, the GitHub website uses a large number of JavaScript, AJAX, HTML5 and other technologies in WEB design to support rendering and display of content in markup languages such as Markdown. Attention to detail makes GitHub a rising star in the field of project hosting. GitHub RegistrationThe first step to using GitHub is, of course, registering a GitHub account:
1, first open https://github.com/pricing to register.
2. In the open page, click "sign up now" Registration, 1.1 shows.
Figure 1.1
3, create the user name in the next page, fill in the email and set the password, click "create an account" button to create an account, 1.2.
Figure 1.2
4, select the account type, here we default to select "Free" type, click "finish Sign up" button to complete the registration, 1.3.
Figure 1.3
Note: Depending on our needs, different types of choices are hosted free of charge if the open source project is stored, and a private library is required. The fees are as follows:
Private Library Space |
Fees |
number of private libraries |
Big |
$50/Month |
50 |
In |
$20/Month |
20 |
Small |
$10/Month |
10 |
Tiny |
$5/Month |
5 |
Free |
$0/Month |
0 |
Install Git1. Download and install the latest version of Git.
2. After the installation is complete, open the Terminal command (for Apple system users) or command prompt (for Windows and Linux users).
3. Tell Git your name so that your submission can be correctly tagged. $
after entering the following content:
$ git config --global user.name "YOUR NAME"
4. Tell the GIT email address to associate with your git commit. The mailbox you specify is the same as the one in the mailbox settings. How to keep your email address hidden, please refer to: Keep your email address private.
$ git config --global user.email "YOUR EMAIL ADDRESS"
Verify GitHub with GitWhen you connect to a GitHub repository via Git, we need to validate GitHub, there are two ways to verify this:
- Authentication over HTTPS
- Authentication via SSH
Establishing a connection over HTTPS (recommended)If you choose HTTPS Mode, we can use a certificate helper to cache the GitHub password in Git.
Connect via SSHIf you choose SSH, we need to generate SSH keys on the computer to push or pull from GitHub.
Create a new warehouse on GitHub1. In the top right corner of any page, click +, then click New Repository.
2. Create a short, easy-to-remember name for your warehouse. For example, "Hello-world".
3. Add a description (not required) for your warehouse. For example, "My first repository on GitHub".
4. Choose your warehouse type as public or private:
- Public: A common repository is a good choice for beginners who are just getting started. These warehouses are visible to everyone on GitHub and you can benefit from a collaborative community.
- Private: More steps are required for a privately owned warehouse. They are only available to you, and the owner of this repository belongs to you and the collaborators you designate to share. Private warehouses are only available for paid accounts. For more information, please refer to "What plan should I choose?".
5. Select Initialize this repository with a README.
6, click Create Repository.
Congratulations! You have successfully created your first warehouse and initialized it with a README file.
Submit your first changeA commit is like a snapshot of a file in your project at a specific point in time.
When you create a new repository, you initialize it with a README file. The README file has a detailed explanation of your project, or adds some documentation on how to install or use the project. The contents of the README file are automatically displayed on the home page of your warehouse.
Let's submit a change to the README file.
1, in your warehouse file list, click Readme.md.
2. Above the contents of the file, click the Edit button.
3. On the Edit File tab, enter some information about yourself.
4. Above the new content, click on Preview changes.
5, check your changes to this file, you will see the new content is marked with green.
6. At the bottom of the page, under "Commit changes", enter some short, meaningful submissions to explain the changes you made to this file.
7. Click Commit Changes.
Fork a sample WarehouseFork is a clone of a warehouse. Cloning a warehouse allows you to experiment with various changes without affecting the original project.
In general, forks is used to change someone else's project (contribute code to an already open source project) or use someone else's project as an initial development point for your own ideas.
Propose to change someone else's project
A good example of using forks to propose a change is bug fixing. Instead of documenting a problem you find, you might as well:
- Fork this warehouse
- To repair
- Submit a pull Requset to the owner of this project
If the owner of the project agrees with your results, they may update your fix to the original warehouse!
Use other people's projects as an initial development point for your own ideas
The core of open source is shared code, and we can make better, more reliable software.
In fact, when you create a warehouse on GitHub, you have the option to automatically include a license file that determines whether you want to share your project with others.
Fork a warehouse is divided into two simple steps. We have created a warehouse for you to practice!
- On GitHub, locate the Octocat/spoon-knife warehouse.
- In the upper-right corner of the page, click the Fork button.
That's it! Now you have to fork this original Octocat/spoon-knife warehouse.
Sync your Fork WarehouseYou may have already fork a project in order to commit changes to upstream or to the original repository. In this case, it's a good implementation to synchronize the upstream warehouse regularly to your fork. To do this, you need to use Git on the command line. You can use the Octocat/spoon-knife warehouse you just fork to practice setting up the upstream warehouse.
First step: Install GitYou should first install Git if you haven't. And don't forget to verify GitHub with Git.
Step two: Create a local clone for your fork's warehouseNow that you have successfully fork the Spoon-knife warehouse, there is no file for this repository on your own computer. Let's clone your Fork's code to your local computer.
1. On GitHub, locate the Spoon-knife warehouse where you fork.
2. In the right sidebar of your fork's warehouse page, click the Copy icon to copy the URL of your fork.
3. Open the Terminal command (for Apple system users) or command prompt line (for Windows and Linux users).
4, enter git clone
, and then paste the URL that you copied in step 2. It looks like this, using your GitHub username instead YOUR-USERNAME
:
clone https://github.com/YOUR-USERNAME/Spoon-Knife
5. Press Enter and your local clone is created.
$ git clonehttps://github.com/your-username/spoon-Knifecloning into ' Spoon-knife ' ... remote: counting objects: 10, done. remote: compressing objects: Span class= "Hljs-number" >100% (8/8), Done. Remove: total 10 (Delta 1), reused Span class= "Hljs-number" >10 (Delta 1) unpacking objects: 100% (10/10) , done.
Now you have the local clone code for your fork's Spoon-knife warehouse!
Step three: Sync your fork's original Spoon-knife repository by configuring GitWhen you fork a project to make changes to this original repository, you can configure Git to change the original or upstream changes to your local.
1, on GitHub, locate the Octocat/spoon-knife warehouse.
2. In the right sidebar of this warehouse page, click the Copy icon to copy the URL of this repository.
3. Open the Terminal command (for MAC users) or prompt the command line (Windows and Linux users).
4. Change to the local directory where you created your fork in step 2 (Create a local).
- Go back to the root directory and enter only
cd
.
- Enter
ls
to list the files and folders for the current directory.
- Enter
cd
the directory name "into the directory you entered.
- Enter
cd ..
back to the previous directory.
5, input git remove -v
, press ENTER, you will see your fork is currently configured remote repository:
$ git remote -vorigin https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)
6. Enter git remote add upstream
, then paste the URL you copied in step 2 and press ENTER. It looks as follows:
$ git remote add upstream https://github.com/octocat/Spoon-Knife.git
7. Verify the newly specified upstream warehouse in your fork and enter it again git remote -v
. You will see the URL of your fork as the original address, and the original repository URL as upstream.
$ git remote-vorigin https:/< Span class= "Hljs-regexp" >/github.com/your_username/YOUR _fork.git (Fetch) Origin https://github.com/your_username/your_fork.git (push) upstream Https://github.com/original_owner/ original_repository.git (fetch) upstream https://github.com/original_owner/ORIGINAL_ Repository.git (push)
Now you can keep your fork in sync with upstream's warehouse and take advantage of a few Git commands. For more information, please refer to Syncing a fork.
Retrieving other warehouses to ForkEach open warehouse can be fork, so you can search for items you are interested in and fork it!
Explore GitHub is a big platform that allows you to find items of interest. Visit this page frequently to focus on the latest and coolest things.
Follow a manA powerful feature of GitHub is the ability to see what other people are doing or related to.
After you've followed someone on GitHub, you'll get a dynamic notification of their activity in your dashboard. You can click on the Follow button on their page.
Watch a projectIn some cases, you may need to track the dynamics of a particular project in real time, which is similar to tracking a user, but only focuses on the events of that project. You can either send an email subscription to the project or configure the notification settings on the page. Compare typical notifications such as a comment on a patch or issue, or just a comment on a project.
Our friend Octocat has a project called Hello World and we want to check it out.
When you are on the project page, you will find a watch button at the top of the page and click on it.
Congratulations, you have followed this Hello world project. If Octocat updates this item, you will be notified of changes in your control panel.
GitHub for Windows installation1. Download the latest version of GitHub from Windows.github.com.
2. When you open the software, you can choose to log in with your GitHub account or create a new account.
3. On the left, you can see your GitHub account, and you can see the other (users) in your group. Click on a username and you will see which repositories are available and click Clone to clone the repository to your computer.
4. Alternatively, you can click on the + add at the top to add a new local repository.
You are ready to start programming and synchronize modifications with GitHub for Windows.
ForkCloning directly from GitHub to add libraries is also a good choice.
1. You can use GitHub to browse related projects directly from your personal account or from the organization you belong to.
2. You can also do one-click cloning directly on GitHub via the clone in Desktop button.
Submit to LocalYou have updated the data locally and need to submit it to the local repository first:
1. Click the name of the library you want to sync.
2, you will see a form, listing your latest changes. Add a commit log (optionally add a description) and submit.
Synchronizing remote WarehousesWhen there is a new local commit record, the In sync button is lit and the text becomes sync, just click the Sync button and sync to the remote repository on GitHub.
GitHub for Mac Installation1. Download the latest version of GitHub from Mac.github.com.
2. When you open the software, you can choose to log in with your GitHub account or create a new account.
3. On the left, you can see your GitHub account, and you can see the other (users) in your group. Click on a username and you will see which repositories are available and click Clone to clone the repository to your computer.
4. Alternatively, you can click on the + add at the top to add a new local repository.
You're ready to start programming and sync changes with GitHub for MAC.
ForkCloning directly from GitHub to add libraries is also a good choice.
1. You can use GitHub to browse related projects directly from your personal account or from the organization you belong to.
2. You can also do one-click cloning directly on GitHub via the clone in Desktop button.
Submit to LocalYou have updated the data locally and need to submit it to the local repository first:
1. Click the name of the library you want to sync.
2, you will see a form, listing your latest changes. Add a commit log (optionally add a description), then click Commit and Sync Master, commit the changes to the local repository, and synchronize to the remote repository at the same time.
Synchronizing remote WarehousesWhen there is a new local commit record, the Sync button in the upper-right corner is lit and clicked to sync to the remote repository on GitHub.