Project development under Windows, using Git to connect to git libraries via ssh, while SSH uses public key to connect.
First you need to download the mygit and use Git bash after installation. Git bash (with GUI interface, such as tortoisegit after installation). I mainly use the command line, its command-line system similar to the Linux Environment Basic operation commands, you can see directly C:, such as cd/d/mygitwork, into my D disk under the engineering directory, put the development of the project.
My action: A key pair was generated with Ssh-keygen ssh-keygen-t RSA in Windows git Bash, and CP. Ssh/id_rsa.pub Authorized_keys renamed. Put this key to colleagues, he as the library creator on the GitHub, add to the project git library, I clone the Git library, I can make the submission code, the specific steps:
If you have already generated SSH key with your own mailbox, you can omit steps 1 and 2
1. Generate Ssh-key
Ssh-keygen-t rsa-c "XXX@company.com"
2, rename Ssh-key
CP ~/.ssh/id_rsa.pub ~/.ssh/xxx@company.com.pub
3, send mail to git library owner, add it to git library, get permission to use, put ~/.ssh/xxx@company.com.pub into mail attachment
Connect to git library: SSH uses public key to implement write functionality.
(The general company will build its own git server, if it is its own, you can use the free git server github.) Specific use, described in the following)
Git library is built, with git clone connection, but such a library, only read function, no write function. If you want to write, you must use SSH, after the connection, submit your own public key, by the library's administrator to add the public key to the GIT library, resulting in access rights.
The principle of public key is introduced here Http://hi.baidu.com/beijiqieys/item/4643900f6ae51223a0312dc8
The specific command is to generate a key pair with ssh-keygen-t RSA, creating a pair of public private keys on the client (public key file: ~/.ssh/id_rsa.pub; private key file: ~/.ssh/id_rsa)
Then put the public key on the server (~/.ssh/authorized_keys) and keep the private key. When you log on with SSH, the SSH program sends the private key to match the public key on the server. If the match succeeds, you can log in.
To copy a public key file to a remote server:
$ SCP ~/.ssh/id_dsa.pub User@remote.host:pubkey.txt
$ ssh User@remote.host
$ mkdir ~/.ssh
$ chmod. SSH
$ cat Pubkey.txt >> ~/.ssh/authorized_keys
$ RM ~/pubkey.txt
$ chmod ~/.ssh/*
$ exit
The setting of permissions is important because unsafe setting of security settings makes it impossible for you to use the RSA feature.
Cat. Ssh/id_rsa.pub | SSH user_b@your_ip "cat->>/root/.ssh/authorized_keys"
can also be used
Ssh-keygen #生成证书.
Ssh-copy-id-i id-rsa.pub user @ip #把证书传到远程的那个机器上 and generates Authorized_keys files.
Library creation on GitHub:
Create a GitHub Repository, register a GitHub account (https://github.com/), and in GitHub, a project that corresponds to a unique git version library, creating a new version of the library is creating a new project. To access the dashboard (Dashboard) page, as shown in the following illustration, you can see that there is already one in the Focus version library, but your own version library is zero. There is a button "new Repository" in the Version library list panel displayed as zero, and click the button to start creating a new version library.
We named the new version library "Kxt-example", the corresponding project name is "Kxt-example", after the creation of the project page, prompted the version library has not been initialized, and gives help on how to initialize the version library, as shown in the following illustration ( Since my kxt-example has already been initialized, the following image is truncated to another uninitialized item. Be sure to set up git, the official website has been made clear, this is no longer introduced here.
Note Any GitHub user can access this public version library using this URL, but only the version library creator Luffyke has read-write access, and others have read-only access. Before you initialize a version library, it is a good idea to verify that you are authenticating with the correct public key.