Git-related configuration and problems encountered when gitblit is used as the server

Note: The server is built with gitblit, and the client is built with git+tortoiseGit. Build the gitblit server side and search online by yourself, so I won’t go into details here

1. Client configuration

1. Install git first, and then install tortoiseGit. The default installation is fine.
2. Configure your own git account, set Git user name and email:

$ git config --global user.name "你的用户名"
$ git config --global user.email "你的邮箱"

3. If you use the ssh password-free method, you need to configure the ssh  key. You can set the ssh key in the user center of gitblit, so first generate the ssh key locally. 1) Generate the ssh key through the set mailbox:        right mouse button to open the git bash command window ,enter:
   

$ ssh-keygen -t rsa -C "你的邮箱"

       After execution: directly press Enter all the way

After completion, two files id_rsa and id_rsa.pub        will be generated by default in the corresponding path (C:\Users\Administrator\.ssh) 2), Gitblit setting ssh key: copy all the content (public key) in the id_rsa.pub file , paste it to the gitblit server----> SSH Keys in the user center, and click Add to complete. Then the subsequent operations will be operated through the ssh:// protocol, and no password is required. as follows:
   

2. The following problems occur during use

fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Use the following command to check whether the username and email address are correct

git config --lis

1. If the username and email address are incorrect, use the command mentioned above to modify the username and email

2. If the user name and email address are correct, then modify as follows: Create a new config file in
the C:\Users\Administrator\.ssh folder (no file format, that is, remove the file suffix) and write the following information into the config file to solve the above problems question.

Host * #对那些ip或域名进行如下配置,*表示所有
	HostkeyAlgorithms +ssh-rsa #使用rsa的加密方式
	PubkeyAcceptedAlgorithms +ssh-rsa  #此项可以在拉取和推送的时候不用每次都输入密码

Guess you like

Origin blog.csdn.net/fbbqt/article/details/124097746