One solution for git clone asking for password and failing


#1

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

$ git clone git@yourwebsite.com:user/repo.git
Cloning into 'repo'...
git@yourwebsite.com'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 git@yourwebsite.com 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.