Error to Agent authenticate on jenkins

hello

We i have faced this issue with configuring a new agent

C:/Program Files/Git/bin/git.exe fetch --tags --force --progress – https://MyBitbucketLink/scm/qp/MyrepositoryGit.git +refs/heads/:refs/remotes/origin/ # timeout=10
ERROR: Error cloning remote repo ‘origin’
hudson.plugins.git.GitException: Command “C:/Program Files/Git/bin/git.exe fetch --tags --force --progress – https://MyBitbucketLink/scm/qp/MyrepositoryGit.git +refs/heads/:refs/remotes/origin/” returned status code 128:
stdout:
stderr: fatal: Cannot prompt because user interactivity has been disabled.
fatal: Authentication failed for ‘MyBitbucketLink/scm/qp/MyrepositoryGit.git’

I just changed the Url to security reasons

please check those options

  1. Check and Update Credentials
    The error message indicates that the authentication failed because user interactivity is disabled in the Jenkins environment. This usually happens when the credentials used are incorrect or not properly configured.

Solution: Double-check the Jenkins credentials. Ensure that the ‘Username and password’ credentials are correct, and use a Personal Access Token (PAT) as the password if necessary. After updating the credentials, go back to the URL field and press TAB to prompt Jenkins to validate the URL again.

  1. Use the Credentials Plugin
    If you are using Jenkins agent agents, you should use the credentials plugin to manage your Git credentials. Create a new credential for your Bitbucket user and add it to your Git checkout configuration.

Example Code Snippet:
git(
url: ‘https://my.bitbucket/scm/Project/repository.git’,
credentialsId: ‘my-bitbucket-user-credential’,
branch: “${branch}”
)

  1. Unset the ‘credential.helper’ Git Config Variable
    Sometimes, the issue can be resolved by unsetting the ‘credential.helper’ git config variable. This has been reported to fix similar issues where the Jenkins build hangs during the fetch command.

Solution: Run the following commands to unset the ‘credential.helper’ git config variable:

git config --global --unset credential.helper

  1. Check DNS and Proxy Settings
    The issue might also be related to DNS resolution or proxy settings on the Jenkins server. Ensure that the DNS and server access are correctly configured.

  2. Remove Corporate Proxy
    If you are behind a corporate proxy, it might be causing the issue. Try removing the proxy settings in Jenkins.

Solution: Go to ‘Manage Jenkins → Manage Plugins → Advanced Settings’ and remove the proxy settings.

  1. Update Known Hosts
    If the host key for the Git server is unknown or invalid, you might need to update the .ssh/known_hosts file.

Solution: Delete the line with the host from your .ssh/known_hosts file and manually connect to the host using SSH to accept the host key again.

Command line git was not provided with credentials that allow it to authenticate with the remote repository. Since the repository URL is https, then the credential should be a username / password credential that allows access to the remote repository. Create it from inside the Jenkins “Credentials” page and use that credential in the job definition.