Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git credential fill rejects my input, scheduled on Windows

I want to run a daily task on a Windows server: git-pull + heavy tests.

As I want it to be triggered by a schedule and run from a script, I need the Git credentials to be fed in automatically. I want to use Git credential fill with the syntax key=value

As this is my first time using Git credentials, I may got something basic wrong.

I tried working in both Git Bash (Git extensions --> Ctrl + G) and Cygwin.

There I entered the following lines:

$ git credential fill
protocol=ssh
host=devserver
username=<my user name>
password=<my password>
path=/srv/gitosis/repositories/Matlab.git
<empty line>

Then Git replies with:

warning: invalid credential line:
fatal: unable to read credential from stdin

I also tried to enter only a single line before the empty line and got the same result. I tried only username line, only protocol line, and only host line.

First: What did I do wrong?

Second: What is the correct path to feed?

If I run

git remote -vv

and get:

origin  [email protected]:/srv/gitosis/repositories/Matlab.git (fetch)
origin  [email protected]:/srv/gitosis/repositories/Matlab.git (push)

what is my path?

Third: What is the host name?

Given the output of Git remote, if I run ping devserver and get

64 bytes from 10.10.10.102: icmp_seq=0 ttl=64 time=74 ms

Does it mean that the host is devserver?

like image 381
Oded Avatar asked Feb 11 '16 10:02

Oded


People also ask

How do I change my Git credentials on Windows?

To update your credentials, go to Control Panel → Credential Manager → Generic Credentials. Find the credentials related to your Git account and edit them to use the updated password. This should be the accepted answer if git config --list contains credential.


2 Answers

The easiest way is to use Git Bash to type in your commands, instead of using the Command Prompt. This will solve the stdin problem.

like image 61
ExtinctionEngine Avatar answered Oct 22 '22 10:10

ExtinctionEngine


I found that it was an issue with line endings in the Windows command shell. Holding the Alt key, then press 1 and 0 on the numeric keypad (in other words inserting a Line Feed character), followed by pressing Enter on the keyboard got it working for me.

like image 37
Anthony. Avatar answered Oct 22 '22 11:10

Anthony.