0

To practice git, I created a git user and a bare repository in the directory /home/gituser/project.git. I created a new user and sshkeys stored in /home/Tom/.ssh. I have added the origin master for gituser in user Tom.

I added a readme file, staged it, and committed the changes. While trying to push changes with push origin master, I got this error:

ssh: connect to host desktop-avnq82i port 22: Connection refused fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.

How would I be able to fix this problem? Both of the users have admin permissions on ubuntu 20.04 app in Windows 10 and only the gituser is in a group:dev.

Note that both the users are on the same computer.

Christian
  • 4,902
  • 4
  • 24
  • 42
edge selcuk
  • 109
  • 6
  • 2
    Your immediate issue is not related to Git at all, but rather to ssh: you do not have an *ssh server* running on your machine. To run a server on your machine, find the appropriate server for your OS and configure it to run. Note that you will immediately be probed by all the ssh-server-bug-probers that are on the Internet in general (I get thousands a day). – torek Sep 17 '22 at 23:51
  • Does this answer your question? [ssh: connect to host github.com port 22: Connection timed out](https://stackoverflow.com/questions/15589682/ssh-connect-to-host-github-com-port-22-connection-timed-out) – DevOpsGeek Sep 18 '22 at 00:11
  • Do you need ssh? You should be able to push to `/home/gituser/project.git` on the file system directly, without going through ssh. – knittl Oct 18 '22 at 20:50

1 Answers1

-1

Have you tried added remote repo using git?

steps to follow

git init

git add .

git commit -m "first commit"

git branch -M main

git remote add {url-of-new-git-repo}

asks for username and pwd create a pat token as password is not longer accepted.

also try adding the git to known hosts file.

refer below url for more info

https://gist.github.com/Tamal/1cc77f88ef3e900aeae65f0e5e504794

ssh: connect to host github.com port 22: Connection timed out

DevOpsGeek
  • 302
  • 1
  • 4
  • 15