Github Succinct Tutorial
Category Programming Technology
If you are a Coder, but you do not know Github, then I think you are not a novice-level Coder, because you are not a real Coder at all, you are just a code porter.
But if you are already reading this article, I think you already know Github.
It is Github that makes social programming a reality.
What is Github?
Github is a code hosting platform based on git. Paid users can create private repositories, and we general free users can only use public repositories, which means the code needs to be public.
Github was founded in April 2008 by three developers, Chris Wanstrath, PJ Hyett, and Tom Preston-Werner. It currently has 59 full-time employees and mainly provides version hosting services based on git.
So far, it seems that GitHub's adventure has been successful. According to the description of GitHub on Wikipedia, we can vividly see the growth rate of GitHub:
Today, GitHub is:
A community with 1.43 million developers. It includes top hackers like the inventor of Linux Torvalds, as well as young geeks like the founder of Rails DHH.
The most popular open-source hosting service on this planet. It has hosted 4.31 million git projects, and more and more well-known open-source projects have migrated to GitHub, such as Ruby on Rails, jQuery, Ruby, Erlang/OTP; open-source libraries that have become popular in the past three years are often first launched on GitHub, such as: BootStrap, Node.js, CoffeScript, etc.
A website ranked 414th globally by Alexa.
Register an account and create a repository
The first step to use Github is, of course, to register a Github account. The official website of Github is: https://github.com/. After that, you can create a repository (free users can only create public repositories), Create a New Repository, fill in the name and Create, and then there will be some repository configuration information, which is also a simple tutorial for git.
Github installation
Configure Git
First, create an ssh key
locally;
$ ssh-keygen -t rsa -C "[email protected]"
Change [email protected]
to the email you registered on Github, and then you will be asked to confirm the path and enter a password. We can just press Enter to use the default settings. If successful, a .ssh
folder will be generated in the ~/
directory, go in, open id_rsa.pub
, and copy the key
inside.
Go back to Github, enter Account Settings (account configuration), select SSH Keys on the left, Add SSH Key, fill in any title, and paste the key generated on your computer.
To verify if it is successful, enter the following in the git bash:
$ ssh -T [email protected]
If it's the first time, it will prompt whether to continue. Enter yes and you will see: You've successfully authenticated, but GitHub does not provide shell access. This indicates that you have successfully connected to Github.
Next, we need to upload the local repository to Github. Before that, we also need to set the username and email, because Github will record them every time you commit.
$ git config --global user.name "your name"
$ git config --global user.email "[email protected]"
Enter the repository you want to upload, right-click on git bash, and add a remote address:
$ git remote add origin [email protected]:yourName/yourRepo.git
The following yourName and yourRepo represent your Github username and the newly created repository. After adding it, go into .git
, open config
, and there will be an additional remote "origin" content, which is the remote address just added. You can also directly modify the config to configure the remote address.
#
Create a new folder, open it, and then execute git init
to create a new git repository.
Checkout the repository
Execute the following