user1187506
user1187506

Reputation: 81

nameofrepo.git does not appear to be a git repository

I´m trying to setup git on my own server and push my project there with capistrano.

it still says

fatal: '/home/gitolite/repositories/iminrails.git' does not appear to be a git repository but i can see iminrails.git in directory repositories on server. So i tried different process how to push my repo on server, but I´m still getting this error.

ofer@debianruby:/var/www/iminrails$ scp -r /tmp/iminrails.git [email protected]:/home/gitolite/repositories/
Enter passphrase for key '/home/ofer/.ssh/id_rsa':
bad command: scp -r -t -- /home/gitolite/repositories/
lost connection
ofer@debianruby:/var/www/iminrails$ git push origin master:refs/heads/master
Enter passphrase for key '/home/ofer/.ssh/id_rsa':
fatal: '/home/gitolite/repositories/iminrails.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

Upvotes: 2

Views: 858

Answers (1)

VonC
VonC

Reputation: 1325966

Whe you are usng ssh with a gitolite account, you will use an ssh configure to use forced command.
See Gitolite and ssh

If you look in the authorized_keys file, you'll see entries like this (I chopped off the ends of course; they're pretty long lines):

command="[path]/gl-auth-command sitaram",[more options] ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA18S2t...
command="[path]/gl-auth-command usertwo",[more options] ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEArXtCT...

First, it finds out which of the public keys in this file match the incoming login. That's crypto stuff, and I won't go into it.
Once the match has been found, it will run the command given on that line; e.g., if I logged in, it would run [path]/gl-auth-command sitaram.
So the first thing to note is that such users do not get "shell access", which is good!

Before running the command, however, sshd sets up an environment variable called SSH_ORIGINAL_COMMAND which contains the actual git command that your workstation sent out. This is the command that would have run if you did not have the command= part in the authorised keys file.

The idea is simple:

  • no interactive shell access
  • git command only (so your scp command being not a git command), it is rejected.

If you need to copy an existing local Git repo to a remote Gitolite server, see "moving pre-existing repos into gitolite"

let gitolite create it as a brand new repo as described in the section on "adding users and repos".

cd to the clone on your workstation.
Make sure all the branches are correct and no extra stuff, "temp" branches, etc., are present

now run these two commands

git push --all git@server:reponame
git push --tags git@server:reponame

Upvotes: 1

Related Questions