In the project versioning management, I think everyone is familiar with CVS or SVN, for the emerging git most people still hold a wait and see attitude, this article briefly describes how to use the Git and GitHub Warehouse management project under Windows.
First, download and install Git
There are several implementations of the current version of Windows Git, but we chose the Msysgit release, which is the best compatibility for the time being. : http://code.google.com/p/msysgit/downloads/list
After the download is complete, double-click the installation file and follow the prompts to complete the git installation. Git installation process is very simple, after installation will prompt you to do initial configuration work, here we all follow the default values (PS: I chose the Unix-like prompt when I chose Git bash).
After the installation is complete, the GIT bash boot interface looks like this:
Second, create a GitHub account
GitHub is an SF-like free project management and sharing service platform that you must register as a GitHub registered user to use the services provided by GitHub. GitHub's URL is: http://github.com
Third, build a local git repository
First, git requires the user to provide their own identity, so we need to execute the following command in Git bash:
git config--global user.name ' mc.test '
git config--global user.email [email protected]
Second, choose the Git repository directory
Let's assume that the GIT repository directory is placed in the OpenSource directory of the D drive, which can be done by executing the following command in Git bash:
cd/d
mkdir opensource
Note: Git bash supports most Linux bash terminal commands, and you can try more terminal actions yourself.
Third, build the project and initialize the GIT repository
Our first project is an implementation of converting an XML file into a Python dictionary (dict) object using the Python language: python-xml2dict, complete this step by executing the following command:
mkdir python-xml2dict
CD python-xml2dict
Git init
After doing this, git will create a hidden directory (. git) in the Python-xml2dict directory, which is the repository that Git uses to manage the software version.
IV, manage your project with Git
Now that we can start using git to manage our projects, our project is very simple and contains only 3 files: README, __init__.py, and encoder.py. We copy three files to the Python-xml2dict directory and incorporate them into git management:
#cp/e/workspace/python-module/xml2dict/*.
git add README __init__.py encoder.py
Git commit-m "This is our first time to initialize the project"
The git add command adds the file specified by the parameter to the GIT repository index, and if you add too many files at once you can use: Git Add. Commands are all added.
The git commit command is the real way to add a file to the Git repository, and the-M option allows you to give a brief description of each addition at the command line (PS: We strongly recommend that you give a description each time you submit, so that the project version is consulted), If this command is not given, the default text editor is called so that you can add a description.
Five, submit the project to GitHub management
To submit a local Git project to GitHub we need to add this item to GitHub first, log in to the GitHub home page and click "Create a new one" to complete the project creation as prompted. The project you just created does not contain any files and we need to set it up before we can use it.
1. In Git bash, execute the following command to create the key:
Ssh-keygen-c ' [email protected] '-t RSA
Press the ENTER key all the way, of course, if you want to choose to use the password function, then the prompt to enter the password is to choose your own password. The process is as follows:
2. Locate the key (id_rsa.pub) file you just generated and open it with a text editor and copy the contents. Then go to GitHub site project edit, find the "Deploy Keys" option and click "Add another Deploy key" and paste the content you just copied to save.
3. Test the SSH connection. In Git bash, execute the following command:
ssh-v [email protected]
If you are prompted with an incorrect key, then you need to reconfirm that the previous step was complete and correct.
4, if the previous step test is error-free, then you can now submit the local file to the GitHub repository. In Git bash, execute the following command:
Git push Origin Master
If all goes well, congratulations! ~
Recommend a git usage guide: http://www.linuxgem.org/2008/8/1/git-tutorial.4889.html
Article Source: http://hi.baidu.com/mcspring/item/198f1e977f8f98bccd80e5b3
Using Git to manage GitHub projects under Windows