Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git "does not appear to be a git repository" ip and port instead of domain?

Tags:

git

gitlab

I'm trying to commit my first Git repository to a gitlab instance, which I've set up on a debian-VM. Everything is going to happen via local network. The following commands are shown in gitlab after creating a new repo.

mkdir test
cd test
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin [email protected]:1337:Matt/test.git
git push -u origin master

After entering git push -u origin master this happens:

[email protected]'s password:
fatal: '1337:Matt/test.git' does not appear to be a Git repository
fatal: Could not read from remote repository.

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

Could the problem be the port on which Git is running at? Gitlab is accessible through port 617 so I'am able to reach the GUI via http://xxx.xxx.xxx.xxx:617/Matt/test

The password I've entered seems to be correct, because a wrong password will end up in a "permission denied" message. OT: I don't know why I've to enter a passwd, because I've generated and added ssh-keys, as described in gitlab, but that's an other problem.

like image 561
mat Avatar asked Jun 04 '13 07:06

mat


People also ask

How do I add a URL to a Git repository?

To add a new remote, use the git remote add command on the terminal, in the directory your repository is stored at. The git remote add command takes two arguments: A unique remote name, for example, “my_awesome_new_remote_repo” A remote URL, which you can find on the Source sub-tab of your Git repo.


1 Answers

I've solved my problem. The given port 1337 wasn't the problem, although it was wrong too, because ssh does not seem to be able to handle a port in url:

Using a remote repository with non-standard port

The Git-url which worked for me was:

[email protected]:repositories/Matt/test.git

My Git user home dir is located in /home/git/ and the repositories are stored in /home/git/repositories so i had to add repositories to my Git-path.

The reason why GitLab told me to use the url [email protected]:1337:Matt/test.git seems to be a wrong configured Git path in GitLab. I'll try to fix this now.

Edit:

The wrong host was configured in /home/git/gitlab/config/gitlab.yml. The "host" there must be without port... There is an extra option for the port if needed.

Edit3: Still unable to push or fetch my test-repository without repositories in path.. https://github.com/gitlabhq/gitlab-public-wiki/wiki/Trouble-Shooting-Guide#could-not-read-from-remote-repository

Maybe something to do with rsa-keys but I don't understand how this belongs together.

Edit4: (Problem(s) seem to be solved) My rsa-keys were ok. The problem was that I've configured my sshd_config to allow only a certain user for ssh-login. I've simply added Git to the list of allowed users AllowUsers mylogin git

Now I don't have to login via password anymore (You never have to login via password if ssh rsa keys are set up correctly) and the path works without "repositories" as it should. Now I understand, that this is just a normal ssh-connection - I hadn't realized this before..

The way I figured it out:

login via terminal as root:

service ssh stop #Current SSH-Connection won't be closed..
/usr/sbin/sshd -d

====debugging mode===

Then in Git Bash:

ssh -Tv [email protected]

Afterwards the terminal with sshd running in debug mode has thrown an error that Git is not allowed to login because of AllowUsers...

Don't forget to start your ssh service afterwards:

service ssh start
like image 68
mat Avatar answered Oct 27 '22 06:10

mat