24

I am trying to install git on a server and have some problem when I try to perform the first push. I successfully installed git on the server, created the repository locally and on the server but when I try to make the first push I get this message:

stdin: is not a tty
fatal: '/my_repo.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

I googled it and followed everything I could find but nothing worked. What could be wrong?

romainberger
  • 4,473
  • 2
  • 32
  • 50
  • 1
    Is the path on the remote server really `/my_repo.git`? Or is it in your home directory or something? – tpg2114 Apr 30 '12 at 23:11
  • I wasn't sure so I tried with `my_repo.git`and `/my_repo.git`and nothing works – romainberger Apr 30 '12 at 23:18
  • 2
    On your server, go to the directory that is the repository and type `pwd`. The output is the full path of the repository, make sure you use that. – tpg2114 May 01 '12 at 00:30
  • 1
    Where is the repository installed on your server? Are you connecting to the remote server using `ssh`? Have you verified that `ssh` functionality is working outside of `git`? How did you connect your local repository to the remote repository -- did you use `git clone`? What command did you type exactly? Did you use `git remote add`? Again, what was the exact command? Can you show us your full `git push` command line (that is, are you typing anything other than simply `git push`)? – larsks May 01 '12 at 00:35
  • thanks @tpg2114 for the `pwd` command I did not know how to get the full path – romainberger May 01 '12 at 08:27

4 Answers4

57

I will assume you are using ssh to clone your repo.

That means you need the full path of the repo on the server in your ssh address:

git clone ssh://sshuser@serverIP/full/absolute/path/to/my_repo

Note: if your 'my_repo' is a bare one (to allow pushing), that would be:

git clone ssh://sshuser@serverIP/full/absolute/path/to/my_repo.git

The stdin: is not a tty simply means that in the .bashrc of the sshuser account, there is something expecting an input.

VonC
  • 1,129,465
  • 480
  • 4,036
  • 4,755
11

May be you forgot to run git --bare init on the remote folder That was my problem

user3353537
  • 161
  • 2
  • 3
1

Or, you can simply use:

git clone user@server:/full/path/to/your/directory
Lucky
  • 15,935
  • 19
  • 113
  • 150
dushshantha
  • 437
  • 5
  • 10
0

A non-jailed/non-chrooted git user may also be the issue source, and setting the user's home directory (~/) may also help. For example, change:

git clone -- 'ssh://user@host:port/dir/repo.git';

to

git clone -- 'ssh://user@host:port/~/dir/repo.git';

Related: Git "does not appear to be a git repository" (It is also possible to use ~ in the path when you...)

Faither
  • 698
  • 3
  • 14
  • 25