I have a domain on netlify which is linked to a public git repository. Regarding https://remcostoeten.nl. A nextJS project. Worked perfectly fine. Locally I started working on a new feature where I fetch data from a private github repository (repo is maintained by me, same account as the public one is).
Folder structure is like this:
Nextjs app
.git – linked to remcosoteten.com.
pages/xxx/private-api-remote/.git – Here I did git clone privateurl.
Locally this works perfectly fine, I can just clone the private repo in my initial repo, but while deploying to netlify production I get some errors which I assume are because it’s private. How do I work around this? i’ve googled some and tried some solutions but can’t get it to deploy.
Besides the initial git pull private remoteurl i’ve also tried removing the remote/folder and clone with git add submodule privateurl wihich also failed.
I have added it as a submodule. Also generated netlify’s deploy key and added that ssh key to github. Still won’t deploy…
1:26:09 AM: Waiting for other deploys from your team to complete. Check the queue: Netlify App
1:26:20 AM: Failed during stage ‘preparing repo’: Error checking out submodules: : Submodule ‘private’ (https://github.com/remcostoeten/apis-private.git) registered for path ‘private’
Cloning into ‘/opt/build/repo/private’…
fatal: could not read Username for ‘https://github.com’: No such device or address
fatal: clone of ‘https://github.com/remcostoeten/apis-private.git’ into submodule path ‘/opt/build/repo/private’ failed
Failed to clone ‘private’. Retry scheduled
Cloning into ‘/opt/build/repo/private’…
fatal: could not read Username for ‘https://github.com’: No such device or address
fatal: clone of ‘https://github.com/remcostoeten/apis-private.git’ into submodule path ‘/opt/build/repo/private’ failed
Failed to clone ‘private’ a second time, aborting
: exit status 1
1:26:20 AM: Finished processing build request in 5.28s
Sorry for the delay I checked your most recent deploy log. It looks like it is still failing to compile because it can’t identify the module. You can try uninstalling and reinstalling the module. If that doesn’t work this is what I found:
You need to install web vitals. Open your terminal and run the following command:
Hi thanks for checking the logs. Web vitals doesn’t sound familiar so I will make sure to remove that.
I’ve managed to deploy with the private sub module. I had to add the key generated over Ssh or https, can’t remember which one it was but the netlify docs do not state that. So the docs should be updated. I can look tomorrow what exactly is missing and write a small update.
Besides that my git is having quite some problems due to the sub modules and branches not merging properly. So I should turn off auto deployment. Or maybe there’s a way to make nextJS build less strict.