One solution for git clone asking for password and failing

If you’ve installed GitLab before or even it is currently in use, you may run into problems like:

$ git clone [email protected]:user/repo.git
Cloning into 'repo'...
[email protected]'s password:

… and after you input the password of git user on your server:

fatal: 'user/repo.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Try ssh [email protected] and see if you are using an sh instead of a bash, and use pwd to see if you are in someplace like /var/opt/gitlab (I can’t quite remember the path but it’s clearly not the home directory of git).

If so, the ssh may not work properly with the influence of GitLab. You may want to restore the home path back to normal:

systemctl stop gogs
usermod -d /home/git git

If it tells you that the git user is still in use by some process, have a look of what the process is using top or htop and you may stop or kill it and restart it back afterwards.

1 Like

I have exactly the same problem as you,but it’s not home path
git user ssh with git-shell
I want to know how to config git users? about login bash and other?