About permissions for accessing git repository Using SSH certificates

Source: Internet
Author: User

Previously, the company built a git repository, and the code we wrote was put on it. use cygwin (which includes ssh-keygen for generating SSH private key and public key certificates, git for downloading and synchronizing Source Code) to ensure that git can be used in the same way on Windows. the GIT Windows version on the Internet has not been used.
When I leave this afternoon, my colleagues have previously synced their code to git. I am not familiar with GIT because of code conflicts, in cygwin. the SSH folder (this folder stores its own private key, public key, and trusted host file) is compressed and backed up, And you plan to go back to your computer to process the code at night.
After you come back, cygwin is installed on your computer to back up the previous one. put the SSH folder in your home directory in cygwin. This git clone retrieves the source code from the company code repository. the following error is returned (some content involves privacy, and I replaced it with five asterisks):
$ Git clone git @ *****. Git
Cloning *****...

@ Warning: unprotected private key file! @

Permissions 0750 for '/home/Leipei/. Ssh/id_rsa' are too open.
It is recommended that your private key files are not accessible by others.
This private key will be ignored.
Bad permissions: Ignore key:/home/Leipei/. Ssh/id_rsa
Git @ *****'s password:
Connection closed *****
Fatal: the remote end hung up unexpectedly
First, I am prompted that the permission for my private key is too high, 750. then, I was prompted to enter the remote git repository connection password. In fact, the previous connection to git does not require a password. Just provide your own private key file. this is confusing. I did not enter the password. As a result, the connection was disabled by the remote host.
The first instinct is that there is a problem with the content backup in the SSH folder, and the file is damaged. But I carefully read the error message, which is a problem with the permission of the private key file. I checked the permission:
$ LS-l
Total usage 6
-Rwxr-x --- 1 Leipei none 1679 September 16 19:03 id_rsa
-Rwxr-x --- 1 Leipei none 401 September 16 19:03 id_rsa.pub
-Rwxr-x --- 1 Leipei none 396 September 16 19:03 known_hosts
The permission of the id_rsa file (my private key file) is indeed 750 as prompted previously. At this time, the permission is changed:
Chmod 700 id_rsa
Then, don't worry. I changed the permission of the public key file to 740 using chmod. Then I went to the GIT repository. Haha, this time I was able to clone the code from a remote location to my local location:
$ Git clone git @ *****. Git
Cloning into mbook-reader-android...
Remote: counting objects: 50, done.
Remote: compressing objects: 100% (26/26), done.
Remote: total 50 (delta 5), reused 0 (delta 0) sorting ing objects 92%
Grouping objects: 100% (50/50), 14.49 kib, done.
Resolving deltas: 100% (5/5), done.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.