Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fatal: could not read Username for, No such device

Tags:

git

jenkins

In my Jenkins job, I am configuring git in the following way:

sh("git config user.email [email protected]")
sh("git config user.name my-user-name")
sh("git tag ${BUILD_NUMBER}")
sh("git push origin --tags")

However, on the last line, when I try to push to my repository, I get the following error about the repository:

fatal: could not read Username for 'http://my-git-repo.com:8000': No such device or address

What's wrong and how can I make it push to the repository?

like image 781
octavian Avatar asked Mar 03 '17 10:03

octavian


People also ask

What is github https username?

Your user name is what immediately follows the https://github.com/ .

What is git credential?

Git has an internal interface for storing and retrieving credentials from system-specific helpers, as well as prompting the user for usernames and passwords. The git-credential command exposes this interface to scripts which may want to retrieve, store, or prompt for credentials in the same manner as Git.

What happens when you git clone?

The Git clone command will create a new local directory for the repository, copy all the contents of the specified repository, create the remote tracked branches, and checkout an initial branch locally. By default, Git clone will create a reference to the remote repository called origin .


1 Answers

You're looking for credential.username. I don't know about the passphrase, but if you dislike http://username:[email protected]:8000 then put the credentials in your Jenkinsfile like so:

The second most common type of Credentials is "Username and Password" which can still be used in the environment directive, but results in slightly different variables being set.

environment {
   SAUCE_ACCESS = credentials('sauce-lab-dev')
}

This will actually set 3 environment variables:

SAUCE_ACCESS containing <username>:<password>
SAUCE_ACCESS_USR containing the username
SAUCE_ACCESS_PSW containing the password

credentials is only available for Declarative Pipeline. For those using Scripted Pipeline, see the documentation for the withCredentials step.

like image 200
Cees Timmerman Avatar answered Nov 15 '22 23:11

Cees Timmerman