Transferred from: http://blog.csdn.net/airk000/article/details/7738231
Git is a code management tool for Linus, which is simply a developer's Super gospel, and as a personal developer of Dick Wire, buying a server or GitHub pay service is obviously not a bargain, so can you build a git repository to manage your code locally? The answer is of course you can!
(Install Git or something will not say, very simple apt-get install git-core OK)
In this example, the warehousing is set to ~/git_store/, and the code for the development is located in the folder ~/git_example/
So build Git_store first.
Mkdir-p Git_store
CD Git_store
Git init--bare
OK, now that the warehouse has been set up, just waiting to hoard the code inside.
CD ~/git_example
Git init
/* will appear to indicate that you have built an empty git */
Git addx
/* Add all the files in the current directory */
Git commit-m ' first commit '
/* Commit for the first time, no commit is not allowed for push */
Git remote add Origin ~/git_store
/* Add origin, the name pointing to ~/git_store,origin can be any, the default branch is master*/
Git push Origin Master
/* This step is completed after the code has been submitted, you can use GITK verification */
OK, now you can safely start to modify the code, even if what happened unexpectedly can be restored through the local git storage, but also can establish a number of branches for different requirements development, without the purchase of servers and GitHub pay services, local can also be convenient, secure development and management of code!
Using Git to create a local warehousing management code "go"