Git connection is not working

Asked 1 years ago, Updated 1 years ago, 52 views

Thank you for your continuous support.
I would like to ask you to teach me because I cannot proceed with building a Git environment.

GitLab is installed in the CentOS 7+ Apache environment.
GitLab installation is complete.
I registered the SSH public key and checked to the point where it came into operation on GitLab, but when I connect to SourceTree, ToutoisGit, etc., I get an error.
Could someone please teach me?

[Prerequisite]
CentOS7+Apache+GitLab
The port setting for sshd has been changed from 22 to 10022
GitLab coexists with Apache using 4080 ports.SSL present.
The Gitlab account should be "test" and the email address should be "[email protected]".
Gitlab uses a subdomain and operates on git.test.com.

Set ~/.ssh/config, etc.

I think I was able to log in without any problems (Welcome to GitLab, test!)

Host git.test.com
  User git
  Port 10022
  HostName git.test.com
  RSA Authentication yes
  IdentityFile through /.ssh/test/id_rsa

We have also been able to confirm that Git's operational history is displayed within the project after following the "Create a new repository" instructions provided when creating the project in GitLab.

$git clone [email protected]:test/test.git
$ cd test
$ touch README.md
$ git add README.md
$ git commit-m "add README"
$ git push-u origin master

Now that I've checked it, I've tried to connect with SourceTree and ToutoisGit, but I get the following error:

FATAL ERROR:Network error:Connection refused
fatal —Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

Also, when I try Git Bash, I get the following error:

$git push-u origin master

ssh: connect to host git.test.com port 22: Connection refused
fatal —Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

I've looked into it and tried various things, but I haven't been able to solve it.
It looks like I'm going to connect to Port 22, so I'll send you the URL
ssh://[email protected]:10022:test/test.git
I tried it as shown in , but the result was the same.
(also ssh://[email protected]:test:10022/test.git)

event ssh-agent
ssh-add to /.ssh/id_rsa
I tried this area too, but it didn't work.

config/gitlab.yml
Here, I found a description that says "ssh_port:10022" so I tried it too, but when I accessed the GitLab URL, it became 502, so I'm returning it now.

The logs for //var/log/messages 」 are as follows:

Sep305:03:13 133-130-106-145 nm-dispatcher:Error: aninet prefix is expected father than "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

The log for "/var/log/secure" is as follows:
Sep304:50:16 133-130-106-145 sshd [10846]: pam_unix(sshd:session): session opened for user git by (uid=0)
Sep 304:50:16 133-130-106-145 sshd [10848]: Received disconnect from 133.130.106.145:11:disconnected by user
Sep304:50:16 133-130-106-145 sshd [10846]: pam_unix(sshd:session): session closed for user git

I think there's something wrong, but would anyone know?
I apologize for the inconvenience, but I appreciate your cooperation.

git

2022-09-30 21:18

2 Answers

If you installed gitlab in the omnibus package (if it was installed in yum, here it is), you should edit /etc/gitlab/gitlab.rb instead of gitlab.yml.
In this case, the value should be changed to 10022 by removing the comment out of the line labeled gitlab_shell_ssh_port'], and then executing the sudo gitlab-ctl reconfigure command should reflect it.

If successful, the URLs listed on the top pages of each project will also be updated to the correct values (probably as written by yaegashi ssh://[email protected]:10022/test/test.git).

~/.ssh/config editing is not required.

Note:

(Below is a separate solution that is not related to the above.)

The host (Windows) trying to run GitBash, SourceTree, and TortoiseGit may not have ~/.ssh/config set.
[email protected]:test/test.git requires the same settings in the Windows environment.


2022-09-30 21:18

If you want to use the URL format,

 ssh://[email protected]:10022:test/test.git

not

 ssh://[email protected]:10022/test/test.git

I think is correct.


2022-09-30 21:18

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.