Code management, in the daily development is very important link, Programmer's practice trilogy-version control, unit testing, project automation.
This article is simply about managing the code in GitHub with Msysgit to achieve version control.
SVN and Git
When it comes to versioning, you have to mention its history. The most popular version control tool is CVS, but CVS has the drawback that it has to use a centralized codebase for networking, so SVN is on the historical stage, and now many companies are using SVN, a centralized tool for managing code that enables multiple individuals to work together to develop a product, and has a very powerful branch label function.
But SVN is also limited to centralized management, and all of the code is in one place, which is also quite inconvenient.
Open source contributor Linus, in order to meet the needs of Linux open source projects, has developed git, a distributed code management tool, that is, the code is distributed in the form of storage, each machine can be used as the code of the managed server.
And now the popular online code hosting GitHub is a code-management community built on Git.
Even now, fresh graduates looking for work, no use of GitHub or without their own open source projects will be despised.
So, this article tells you how to manage GitHub's code under Windows.
Register for GitHub, create a code base
GitHub site: https://github.com
Registration process will not say, after registration, directly click
You can create your own code base.
Download Client Tools
With the code base on GitHub, we have our own code hosting server.
A client program is also required to communicate with the server to manage the code:
Similar to SVN, Little Turtle tortoisesvn and visualsvn relationship!
For client tools, you can download the git Windows client on the GIT Web site, or download the Msysgit management tool at the bottom.
This is the recommended Msysgit management tool, which provides Linux-like terminal commands to manage Git.
Can be downloaded in the URL:http://msysgit.github.io/ :
Connect to GitHub using Msysgit
After downloading the installation directly, the next step is to have no brain installation. I installed the process is a bit slow, it has to be about more than 10 minutes.
Once the installation is complete, turn off all dialog boxes directly.
Open the installation directory:
Double-click on the Msys.bat to enter the Msysgit Management command interface, where you can fully use the commands under Linux.
1 first to create the SSH keys file
Input command: ssh-keygen-t rsa-c "[email protected]"
The specific mailbox depends on your situation.
The keys file is generated under the default folder by pressing three carriage returns after the input .
For example, here I have a file called id-rsa.pub under the c://users/administrator/.ssh/ .
Locate the keys file under the appropriate folder:
Use Notepad to open the Id_rsa.pub file and select Copy all!
2 then open your GitHub home page, click on Add SSH keys, copy it, and get a name.
3 Back to the Msysgit command line, use the ssh-t [email protected] test!
Cloning a GitHub library with Msysgit
On the command line, enter:
git clone https://github.com/xinghalo/WorldStar.git
You can copy the corresponding code base to local. The URL that follows is the one that corresponds to your code base.
URL Reference:
Submitting code using Msysgit
The code base has been cloned locally from GitHub, so now we can create the file under the Local folder and submit it to GitHub.
You can see that there are only two files and one folder in the code base.
First create a file:
Add the file using the command git add XXX
Use the command git commit-m "What I want to say" commit the action to the code base
Commit a local commit to GitHub using git push
View the code in GitHub for a successful add file.
MSYSGT managing GitHub Code