How Do You Clone a Git Repository when You Are Being Prompted for a Password and Do Not Know What It Is?

Problem scenario
You have a Git repository on one server.  You want to clone it to another server.  When you try to clone it, you are prompted for a password.  What do you do?

On the destination server, run this (where x.x.x.x is the IP address of the server with the Git repo):

git clone git@x.x.x.x:root/goodrepo.git

If you are prompted for a password, enter the password for the user git.  You could use a different user in your subsequent "git clone" command.  (Such a user must have permissions to read the .git file.  The user is specified immediately before the "@" symbol above.)

Alternatively if you can change the password for the git user, go to the back-end of the server with the git repository.  Run this:  sudo passwd git

Leave a comment

Your email address will not be published. Required fields are marked *