STDERR: fatal: could not read Password for xx No such device or address

2,474 views
Skip to first unread message

Rasih ÇAĞLAYAN

unread,
Oct 4, 2018, 12:57:10 PM10/4/18
to go-cd
Hi.

A) As a summary

- Is there anyone to share step by step how to confiure gocd agent on ubuntu with bitbucket private repository ?
It is really important to me, thanks


B) Details

- I dont have any problem with windows server for go-server and windows server for go-agent
- I already using GoCd with seperated windows servers, one for server, other for agent
- Now i added an Ubuntu agent for .net core projects
- Server still on the Windows 2012R2, i just added one more agent on ubuntu
- When i create pipeline and run  it, i get following error -  screenshot can be found at the end of this message 

STDERR: fatal: could not read Password for 'https://x...@bitbucket.org': No such device or address

I have
Items

- I am using private bitbucket repository

1. GoCd Server installed on  -   Win 2012 R2 32gb 16 core - Name GoCd-Server-Win

2. GoCd Agent  - installed on  - Win2012 R2 64gb 16 core - Name GoCd-Agent-Win

3. GoCd Agent - installed on - Ubuntu 18.04 LTS 1gb 2cpu - Name GoCd-Agent-Ubuntu


Any idea ?
- I tried to git config credential.helper store
- Nothing changed
- When i am cloning my repository on the ubuntu, it does not ask username and password again, because i already store it.
- But GoCd agent still gives error
- Material - Check Connection is ok : Connection Ok with green check but agent could not use password
- Help please


Ankit Srivastava

unread,
Oct 4, 2018, 2:25:38 PM10/4/18
to go...@googlegroups.com
Hi Raish,

In order to diagnose this issue further, I would recommend creating a git wrapper in /usr/local/bin/git which captures stdout/err of the underlying git command and to enable debugging logging of git. Please ensure that /usr/local/bin is available on the PATH before you start your GoCD agent process (you can ensure this by adding export PATH=/usr/local/bin:$PATH` to the file /etc/default/go-agent

The following git wrapper script will write any git logs to `/tmp/git.log` The logs will contain detailed HTTP request/response headers between the git client and your bitbucket instance, including the HTTP password in the standard base64 format Authorization: Basic ....Hopefully, this tells you what's wrong with the git operation being executed.
#!/bin/bash

# enable debug logging of git
export GIT_CURL_VERBOSE=1
GIT_LOG_FILE=/tmp/git.log
echo "=== Executing command $@" >> $GIT_LOG_FILE

# execute the actual git binary, replace this with the actual location of the git executable from `which git`
# the output from git will be written to $GIT_LOG_FILE
exec /usr/bin/git "$@" >> $GIT_LOG_FILE 2>&1

--
You received this message because you are subscribed to the Google Groups "go-cd" group.
To unsubscribe from this group and stop receiving emails from it, send an email to go-cd+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rasih ÇAĞLAYAN

unread,
Oct 4, 2018, 4:41:42 PM10/4/18
to go...@googlegroups.com
Hi Ankit,
Thanks fo quick response.

I followed the steps you offer; but i am not sure i did it right. (i am not experienced ubuntu user). So i want to lise what i did; can you check is please ?

1. I added following line to the /etc/default/go-agent file with sudo nano . Result looks like as following; i saved the file

AGENT_WORK_DIR=/var/lib/${SERVICE_NAME:-go-agent}
export PATH=/usr/local/bin:$PATH

2. I checked /usr/local/bin/git folder. It is not exist; i mean /usr/local/bin exist but "git" folder not. I created it with   mkdir command under bin folder. Is that correct ?

3. I am not sure what to do about script you shared. What should i do with this script ? For example should i create a file that contains this script ? If it is, so how to call from this file

As a summary i did not understand how to create git wrapper part and what to do with this script ?

Thanks


Ankit Srivastava <2015....@gmail.com>, 4 Eki 2018 Per, 21:25 tarihinde şunu yazdı:

Rasih ÇAĞLAYAN

unread,
Oct 4, 2018, 4:51:27 PM10/4/18
to go...@googlegroups.com
- Now i careated  git folder under  /usr/bin
- I crated a file under this folder named with  git.sh
- I paste your script into that file
- I run this command : sudo chmod +x git.sh
- I restart the Ubuntu server and i validated go-agent active
- I started the pipline on GoCd, result was the same error
- I checket /tmp/git.log with nano. It was empty




Rasih ÇAĞLAYAN <rasih.c...@gmail.com>, 4 Eki 2018 Per, 23:41 tarihinde şunu yazdı:

Ankit Srivastava

unread,
Oct 4, 2018, 5:30:25 PM10/4/18
to go...@googlegroups.com
Hi Rasih,

You will need to create "git" file under /usr/local/bin folder with no extension (not git.sh) and give executable permission `chmod +x git`.

Once this done, add export PATH=/usr/local/bin:$PATH` to the file /etc/default/go-agent

This needs to be done on the Ubuntu agent box.

Message has been deleted
Message has been deleted

Rasih ÇAĞLAYAN

unread,
Oct 4, 2018, 6:40:47 PM10/4/18
to go...@googlegroups.com
Hi Ankit,
I clean sensitive data so i post it over 3 times; sorry for that.
O apply the way you offer. 
Now i can see git log.

I am sharing screenshots of the terminal.

It looks like 401 unahorized on second shot but i could not understand what to do. Because i can login as root and i can pull the repository without typing password (already cached - stored).

So why it show 401 i could not get it.

And  it say something about netrc file ....

It should not be hard as that; just cloning repository :) But it is.
Any idea ?

Thanks

image.png

image.png

Ankit Srivastava <2015....@gmail.com>, 5 Eki 2018 Cum, 00:30 tarihinde şunu yazdı:

Ankit Srivastava

unread,
Oct 4, 2018, 7:16:17 PM10/4/18
to go...@googlegroups.com
Hi Rasih,

Can you try logging as "go" user and see if you are able to clone the repository. You can try `sudo su - go` to switch user and try cloning. You don't need any password for "go" user. 

Regards,
Ankit




Rasih ÇAĞLAYAN

unread,
Oct 4, 2018, 7:41:39 PM10/4/18
to go...@googlegroups.com
Hi Ankit,

I try to git clone with go  user.
It asked password! So you were right, there is no credential stored.

What i tried ?

Attempt 1 - Fail
1. I tried to type git config credential.helper store
2. Then i cloned repo
3. Git asked username and password
4. I browse into the git directory
5. I run git pull  then password not needed
6. Then i remove the repo folder 
7. I tried to clone it again
8. It asked username and password again


Attempt 2 - Succeed!

1. I run :  git --global config credential.helper 'cache --timeout 3600'
2. I clone repo with git and type username and password
3. I removed the repo folder
4. I cloned it again and git did not ask the username and password
5. Then i run GoCd pipline for my ubuntu agent
6. It worked succesfully


Now the question is, how to store credentials permanently ?

@Ankit thank you very much, problem partially fixed by your instructions; thanks.


Ankit Srivastava <2015....@gmail.com>, 5 Eki 2018 Cum, 02:16 tarihinde şunu yazdı:
Reply all
Reply to author
Forward
0 new messages