Use ssh to get the code on the git server built by the company

Windows environment:
1. Generate ssh key
ssh-keygen -t rsa -b 4096 -C "[email protected]" -f ~/.ssh/sangyuruo_rsa

2. Start the agent. If it is not started, subsequent operations will report an error
eval `ssh-agent -s`

3. Add key
ssh-add ~/.ssh/sangyuruo_rsa

4. Get the code
git clone [email protected]:my_dev/my.git


Note:
* If you do not perform actions 1, 2, and 3, git clone will ask for a password. This is different from github, and the server in the company needs to change the settings. However, we do not have permission to change, we can only do it on the client side Set as above.
* The above actions need to be executed in the same command environment. And each operation requires 2, 3, 4.
* After the operation is completed, you need to kill the ssh-agent process in the windows process. Refer to http:/ /stackoverflow.com/questions/17846529/could-not-open-a-connection-to-your-authentication-agent/4086756#4086756

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326387078&siteId=291194637