Failed to connect to repository – 401 on Jenkins + Codebase Git

gitJenkins

I'm trying to get Jenkins to use Git as our SCM, and setting it up is being a bit of a pain.

When specifying the Codebase Git repo to use, using the following format:

https://our.domain.com/repository/repository.git

I get the following error from Jenkins:

Failed to connect to repository : Failed to connect to https://our.domain.com/repository/repository.git (status = 401)

The repository is private, and I'm not sure how to configure a user account for it. I've generated a RSA SSH key for the Jenkins user, on my Ubuntu server, and added this to Codebase as a deployment key.

I keep on getting the 404 error?

Also, if I try the

git@codebasehq.com:.../repository.git

format, I just get a different error from Jenkins:

Failed to connect to repository : Command "ls-remote -h git@codebasehq.com:.../repository.git HEAD" returned status code 128:
stdout: 
stderr: Host key verification failed. 
fatal: Could not read from remote repository.

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

Best Answer

I am late but In future this will help to other people

insted of

https://username@bitbucket.org/username/repo.git

replace this

https://bitbucket.org/username/repo.git

in the Git Repository URL