Question

cannot use git with server

First, I am sorry if this is basic question but, i am struggle with this for days.

The problem is every time i do git push (clone) to fakhrul@ipdaresss:/home/fakhrul/proj.git (or any git repo) i will get 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.

I already did lot of research and try every tutorial, but the problem still there. So, i think maybe i did miss something basic. For this, i hope you can answer as talking to really beginner.

What i use? i use Git Bash in Windows, so basically everything is simillar to linux

What i already done i have a user (fakhrul) with sudo access with functional ssh key i can ssh fakhrul@ipadress i done initial setup (firewall), install LEMP, git i successfully create plain laravel project from this tutorial

the only problem is git

Is git is properly install and setup in my local pc and server? git init works in both server and local

What i understand when to use git and what i did? but fail to clone or push

  1. create repo in local
    mkdir proj; cd proj ;

create index.html using notepad with “hello world” in it

git init
git add *
git commit -m "first commit"
2. create repo in server with git bare
ssh fakhrul@ipaddress
mkdir proj.git; cd proj.git
git init --bare
exit
3. back in local to push to server

in proj dir

git remote add origin fakhrul@ipadress:/home/fakhrul/proj.git
git push origin master

then i get this

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.
  • already open git port sudo ufw allow git. but i didnt think this is because i using ssh with git.
Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

GREAT [solved]

What i did to solved this?

  1. uninstall Git For Windows
  2. download Git For Windows 1.9.5 and install by choosing all default choices (use openssh)
  3. now git push over ssh working

What is the problem?

I am not sure, but the problem may be because of Git and putty. I installed Git for long time ago and with less knowledge at that time. Using putty we need to run Pageant with private keys set, i dont understand this. Putty use .ppk format for private key, but i always use ssh-keygen in Git Bash for creating ssh keys.

Thank you for everyone who views this and try to help.

:: i have new problem write failed :connection reset by peer, but this will go for another thread (if i cannot solved by own research)