26

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?

5
  • 1
    Is the path on the remote server really /my_repo.git? Or is it in your home directory or something? Commented Apr 30, 2012 at 23:11
  • I wasn't sure so I tried with my_repo.gitand /my_repo.gitand nothing works Commented Apr 30, 2012 at 23:18
  • 3
    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. Commented May 1, 2012 at 0: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)? Commented May 1, 2012 at 0:35
  • thanks @tpg2114 for the pwd command I did not know how to get the full path Commented May 1, 2012 at 8:27

4 Answers 4

59

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.


Abpostman1 adds in the comments:

Had this issue because I was trying to push in a --bare repo non empty.
Even if it was exactly the same files, I had the same error message: "Not git repository"

I had to backup my /httpdocs remote folder, create an empty new /httpdocs folder, do again git init --bare and re-push from local.

My remote address : url = ssh://magento@magento/home/magento/httpdocs (with a private/public key in both sides)

Sign up to request clarification or add additional context in comments.

5 Comments

Thanks it worked, it was indeed the full path that was missing. The stdin: is not a ttyerror is still here though, I will try to fix it.
It is also possible to use ~ in the path when you refer to a project in your home directory, e.g. ssh://name@server/~/myproj/
yah, it work's for me too. thank you from saving me from frustating
Had this issue because I was trying to push in a --bare repo non empty. Even if it was exactly the same files, I had the same error message: "Not git repository" I had to backup my /httpdocs remote folder, create an empty new /httpdocs folder, do again git init --bare and re-push from local. My remote address : url = ssh://magento@magento/home/magento/httpdocs (with a private/public key in both sides)
@Abpostman1 Thank you for your feedback. I have included your comment in the answer for more visibility.
11

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

Comments

1

Or, you can simply use:

git clone user@server:/full/path/to/your/directory

Comments

1

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...)

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.