SSH key - could not read Username for '

Hello all,

I deployed a site ramifyzj-4pp3v6p8bldyilbicu
and the build is failing because netlify cannot connect to the git provider
The full logs below

10:35:01 PM: Build ready to start
10:35:03 PM: build-image version: d2c6dbeac570350a387d832f64bc980dc964ad65 (focal)
10:35:03 PM: build-image tag: v4.8.0
10:35:03 PM: buildbot version: e552b142336b2b1222a93a4fd4cbed0019c77b46
10:35:03 PM: Fetching cached dependencies
10:35:03 PM: Failed to fetch cache, continuing with build
10:35:03 PM: Starting to prepare the repo for build
10:35:04 PM: User git error while checking for ref refs/heads/feat/update-active-deploy
10:35:04 PM: Creating deploy upload records
10:35:04 PM: Failing build: Failed to prepare repo
10:35:04 PM: Failed during stage 'preparing repo': error checking for ref: fatal: could not read Username for '': No such device or address
: exit status 128
10:35:04 PM: Finished processing build request in 1.077601598s

I can generate an ssh key for this specific project and attach it to my git repo but it’s not scalable for my use case as I will be using netlify to deploy multiple sites (maybe 10 to 100 a week)

Is there a way to setup a global ssh key for all the projects at once and only link gitlab once?

Or can I get the ssh key from the API?

I am open to any other solution that would help me automate linking each new site to my git repository

Thank you

Hi there,

In that log, you are trying to (make us) connect to the git provider with https and a login/password; we do not support that.

You would indeed need to generate one key per netlify site (not one per repo!) to automate connecting our site to services via an API. This article explains the steps you’ll need, though it leaves you to build the flow you’ll need to access GitLab to get a key, etc:

Once you get it right, you’ll see that we no longer throw errors like the one you quote:

...could not read Username for '': No such ... since deploy keys will not fail with that sort of error, even if they are wrong.