'jenkin git repository getting permission denied(publickey, password) for internal ssh server url
I'm trying to configure flow which include git repository
things to note:
- i have a git server running in internal network
- my jenkin running on one of the machine in the network so it can access git server through local ip
normally i would go like this with my git command
git remote add origin ssh://username@git-server-ip/path-to-folder
after that it prompt me to type in the password for the above username
and i can work on the git repo like normal
The problems:
in Jenkin i already set up credential with "username and password" type
When i paste in the ssh url into the Repository URL, it take a while and return error:
Failed to connect to repository ...
stdout: stderr: Permission denied, please try again. Permission denied, please try again. username@git-server-ip: Permission denied (publickey, password). fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
i had selected credentials and double check username and password it's correct. i tried running the ls-remote command manually in the terminal
git ls-remote -h -- ssh://username@git-server-ip/path-to-folder HEAD
it prompts to input the password, i typed it in and it run normal without error
Why is the error only happens on Jenkins when i input the repo ssh url? is username and password credential the wrong approach for credential? what else should i use?
there no guide online for Jenkin with internal git ssh url as i known of
the closest i can see my problem related to is this question Jenkins Git ssh setup does not let me use username/password , but it doesn't have an accepted answer yet, and the answer suggest going with "ssh username and private key"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
