1. What is a public and private ssh-key? This pair of keys for one user? If so, then for each user I have to save his public key in GitHub settings? Or is one public key enough for everyone?

  2. Why do I need a password (passphrase) to connect via ssh to the repository on GitHub? This password is only needed to access a pair of ssh keys that are stored in the ~/.ssh folder ( имя_ΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚Π΅Π»Ρ/.shh )? Or does this password also know the repository on GitHub?

  3. A pair of ssh keys is stored in the user folder on Windows. If I want to join another ssh repository, then I will have to change this pair of ssh keys?

  4. If you delete a branch, then delete all its commits? Although if you think about it, then the branch is just a pointer to a commit, then this pointer will be removed, and not the commits themselves. So?

  5. I am already confused with these commands ΠΏΠ΅Ρ€Π΅Ρ…ΠΎΠ΄Π°_Π½Π°_ΠΊΠΎΠΌΠΌΠΈΡ‚ / измСнСния_ΠΊΠΎΠΌΠΌΠΈΡ‚Π° / удалСния_ΠΊΠΎΠΌΠΌΠΈΡ‚ΠΎΠ² , etc. Which commands remove commits forever and not just remove them from sight? reset (soft / hard)? revert ? anything else?

  6. How to make it stop asking for a password when using an ssh connection? For example, when using git push or git fetch .

  7. MS Visual Studio 2010 has created the main.cpp file. When trying to index it (and other files with MS VS code), an error is displayed:

    Fatal: LF in main.cpp.

    I was searching in Google and there was something about it, but I did not understand how to solve this problem.

  • four
    You are not one of those people who ask the seller in the store exactly where the player turns on? - pirj
  • What are you talking about? - chevchelios

1 answer 1

1) What is a public and private ssh key?

The generated pair of texts allows you to encrypt and decrypt data. You can also use it as a user ID (really long).

This pair of keys for one user?

Yes. One user can have many keys. (One for a working computer, one for a laptop, ...)

If so, then for each user should I save his public key in GitHub settings? Or is one public key enough for everyone?

As far as I know, github does not allow using the same key in several accounts. We'll have to generate a pair for each account.

2) Why do I need a password (passphrase) to connect via ssh to the repository on GitHub?

To increase the level of protection. It protects access in case of theft of a private key.

This password is only needed to access a pair of ssh keys that are stored in the ~ / .ssh folder (username / .shh)? Or does this password also know the repository on GitHub?

This password has nothing to do with github, only to the key. Specified at the time of key generation.

3) A pair of ssh keys is stored in the user folder on Windows. If I want to join another ssh repository, then I will have to change this pair of ssh keys?

Not. Keys are used to access the server from a specific computer. You can generate a pair, and use it to access github, bitbucket, some of your servers. Well, adding the key in the account settings you use it to work with all the repositories that the service provides.

4) If you delete a branch, then delete all its commits? Although if you think about it, then the branch is just a pointer to a commit, then this pointer will be removed, and not the commits themselves. So?

I do not know for sure. In theory, they should not, but git uses a compression procedure during which they can be deleted. On the SO, it is recommended to add a tag for a branch (for the last commit) and delete it, then the commits will remain and the branch will not be an eyesore.

5) I'm already confused with these transition_to_commit / change_commit / delete_commit commands, etc. Which commands remove commits forever and not just out of sight? reset (soft / hard)? revert? anything else?

revert does not delete, it only reverses the changes with a new commit.

On the question: I do not know, I always had a reset .

6) How to make it stop asking for a password when using an ssh connection? For example, when using git push or git fetch.

Generate a new key, while entering a password, do not enter anything.

7) MS Visual Studio 2010 created the main.cpp file. When trying it (and other files with code from MS VS) to index the error: Fatal: CRLF replaced by LF in main.cpp. I was searching in Google and there was something about it, but I did not understand how to solve this problem.

Windows-specific problem. In theory, it's okay, they propose to add to SO

 [core] autocrlf = false 

I sit on Linux, so I can not help here.

ADDED:

And what if through one account, but on different computers or users in Windows?

You can generate a new key, and add it as the second in your account settings.

Those. can i use one key pair for any repositories? In general, anything (what works through ssh)?

Yes.

Well, adding the key in the account settings you use it to work with all the repositories that the service provides. All repositories of one account you mean?

Yes.

  • > As far as I know, github does not allow using the same key in several accounts. We'll have to generate a pair for each account. And what if through one account, but on different computers or users in Windows? > No. Keys are used to access the server from a specific computer. Those. can i use one key pair for any repositories? In general, anything (what works through ssh)? > Well, adding the key in the account settings you use it to work with all the repositories that the service provides. All repositories of one account you mean? - chevchelios
  • one
    As for the error, it turns out I did not carefully look in the instructions and wrote for mac / unix, but for Windows I need: git config --global core.autocrlf true git config --global core.safecrlf true - chevchelios pm
  • 3
    Yes, reset removes commits. --soft leaves changes, but deletes commits themselves. --hard removes permanently. - Vladimir Gordeev