Getting started with github

[First acquaintance with Github]
First of all, let us all shout "Hello Github" together. YEAH! That's it.

Git is a distributed version control system originally written by Linus Torvalds for the management of Linux kernel code. After its launch, Git has seen a lot of success in other projects, especially in the Ruby community. Currently, many well-known projects including Rubinius and Merb use Git. Git can also be used by deployment tools such as Capistrano and Vlad the Deployer. Likewise, the source code of the eoe.cn client is also hosted on github.




GitHub can host various git repositories and provide a web interface, but unlike other services like SourceForge or Google Code, GitHub's unique selling point is the ease of forking from another project. Contributing code to a project is very simple: first click the "fork" button on the project site, then check out the code and add the changes to the code base just forked, and finally be responsible to the project through the built-in "pull request" mechanism People apply for code merge. Some people have already called GitHub the MySpace for code players.

Branching on GitHub is like making friends on Myspace (or Facebook…), with constant connections in the nodes of the social graph.

GitHub uses the git distributed version control system, and git was originally created by Linus Torvalds to help with Linux development, and it targets the Linux platform, so git and Windows were never best friends because it's nothing like Windows. GitHub has released GitHub for Windows, an easy-to-use graphical client for Git for Windows platform developers.

GitHub For Windows
GitHub for Windows is a Metro-style application that integrates a self-contained version of Git, a bash command-line shell, and the posh-git extension for PowerShell. GitHub provides Windows users with a basic graphical front-end to handle most common version control tasks, creating repositories, submitting patches to local repositories, and synchronizing between local and remote repositories. Microsoft also offers its git version control system to developers through CodePlex, while GitHub has created a more attractive Windows version.

Auto-configured Mac laptops on GitHub, a tool that can convert setups for Linux or Windows machines.

BOXEN is GitHub's automated tool for setting up and configuring Mac laptop software development[3] or other types of work that are using them by developers, lawyers, designers, shippers, etc. The idea is to prepare the system to work in an automatic manner and as error-free as possible with the least intervention. According to GitHub, with a new development machine, his Mac system was set up and ready to commit code within 30 minutes.

BOXEN is based on a large collection of dozens of puppet modules that enable setup of various software such as Cassandra, MongoDB, Java software, Python and Ruby development, Node, JS, nginx, Skype, Even MINECRAFT. Although the machine comes with a pre-configured configuration, each user can adjust it to the desired effect of the configuration.


[How to use]

1. Register an account and create a warehouse The first step

to use github is of course to register a github account. After that, you can create a repository (free users can only build public repositories), Create a New Repository, fill in the name and Create, and then some configuration information of the repository will appear. This is also a simple tutorial for git.


2. Install the client msysgit

github is the server. To use git on our own computer, we also need a git client. I choose msysgit here, which only provides the core functions of git and is based on the command line. If you want a graphical interface, just install TortoiseGit on top of msysgit.

After installing msysgit, the right mouse button will have some more options. Right-click on the local repository and select Git Init Here. There will be an additional .git folder, which means that the local git is successfully created. Right-click Git Bash to enter the git command line. In order to transfer the local repository to github, you also need to configure the ssh key.

3. Configure Git

to create an ssh key locally;

[mw_shl_code=java,true] $ ssh-keygen -t rsa -C "[email protected]"[/mw_shl_code]
Change [email protected] to your email address , then you will be asked to confirm the path and enter the password, we just use the default all the way to enter. If successful, the .ssh folder will be generated under ~/, go in, open id_rsa.pub, and copy the key inside.

Go back to github, enter Account Settings, select SSH Keys on the left, Add SSH Key, fill in the title, and paste the key. To verify success, enter under git bash:

[mw_shl_code=java,true] $ ssh -T [email protected] [/mw_shl_code]
If it is the first time, you will be prompted whether to continue, enter yes and you will see: You've successfully authenticated, but GitHub does not provide shell access . This means that you have successfully connected to github.

The next thing we need to do is to upload the local repository to github. Before that, we need to set username and email, because github will record them every time we commit.

[mw_shl_code=java,true]$ git config --global user.name "your name"
$ ​​git config --global user.email "[email protected]"
[/mw_shl_code]
Enter the repository to be uploaded, right-click git bash, Add a remote address:

[mw_shl_code=java,true] $ git remote add origin [email protected]:yourName/yourRepo.git [/mw_shl_code]
The yourName and yourRepo after your repo indicate your github username and the newly created repository, add it Then enter .git, open config, there will be an extra remote "origin" content, this is the remote address just added, you can also directly modify the config to configure the remote address.

4. Submit and upload

Next , add some files in the local warehouse, such as README,

[mw_shl_code=java,true]$ git add README
$ git commit -m "first commit"[/mw_shl_code]
Upload to github:

[mw_shl_code=java,true]$ git push origin master
[/mw_shl_code] The
git push command will push the local repository to the remote server.
The git pull command does the opposite.

After modifying the code, you can use git status to view the differences between files, use git add to add files to be committed, or use git add -i to add files intelligently. After that, git commit submits this modification, and git push uploads it to github.

5. gitignore file. gitignore

, as the name suggests, is a file that tells git to ignore, which is a very important and practical file. Generally, after we write the code, we will perform operations such as compilation and debugging. During this period, many intermediate files and executable files will be generated. These are not code files and do not need to be managed by git. We will see a lot of such files in git status. If we use git add -A to add them, we will add them all, and it is too troublesome to add them one by one manually. At this point we need .gitignore. For example, my .gitignore for general c# projects is written like this:


[mw_shl_code=java,true]bin
*
.suo obj[/mw_shl_code]
bin and obj are the compilation directories, which are not source code, ignore; the suo file is from vs2010 config file, not required. In this way, you will only see the source code files when you are in git status, and you can git add -A with confidence.

6.tag

We can create a tag to point to a key period in software development. For example, when the version number is updated, we can create a tag such as "v2.0" and "v3.1", which will be more convenient for review later. The use of tags is very simple. The main operations are: viewing tags, creating tags, verifying tags, and sharing tags, which are explained in detail in the following blogs.


[Github related articles]
Git introduction, installation, Git+Git flow use: http://my.eoe.cn/fogs/archive/799.html
Git instruction set: http://my.eoe.cn/iceskysl /archive/463.html
Install git-flow process on mac: http://my.eoe.cn/iceskysl/archive/118.html
Simple usage of git fetch: update remote code to local warehouse: http://my .eoe.cn/com360/archive/3533.html
How git rolls back a single file to a specified version: http://my.eoe.cn/com360/archive/3351.html
How to use open source projects on Github: http://my.eoe.cn/com360/archive/3533.html ://my.eoe.cn/fengyiyezi/archive/3427.html
Install MSysGit, gitflow, GitHub under Window (8): http://my.eoe.cn/sunxun/archive/158.html
git tag: http ://my.eoe.cn/xiayang6/archive/446.html
Guide to participating in eoe open source projects based on Github: http://my.eoe.cn/iceskysl/archive/3195.html
Git stash usage: http://my.eoe.cn/sunxun/archive/190.html
Git tag The use of: http://my.eoe.cn/futurexiong/archive/1943.html
The vernacular explains how to contribute code to the project on github: http://my.eoe.cn/leigo/archive/3221.html




Finally , Recommend several posts in the community to introduce the use of github:


The use of github
http://www.eoeandroid.com/thread-272837-1-1.html


The GIT plug-in EGIT manual on Eclipse
http://www.eoeandroid.com /thread-273360-1-1.html Construction


of git server under ubuntuhttp:
//www.eoeandroid.com/thread-273167-1-1.html


git , vim , ls global configuration
http://www.eoeandroid. com/thread-229638-1-1.html



I hope the above will play a positive role in everyone's learning. A good programmer must learn to use github. If you think this article is not bad, tell your friends. If you think you can read it, then share it. If you think it needs to be revised, please point out the shortcomings and give a few e-coins. Finally, I would like to thank Baidu for its selfless support, as well as someone's blog (really, I really forgot what his address is), Hello Github.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326976313&siteId=291194637