Issue with git remote parsing logic
User has a private bitbucket server, with .git/config remote: url = ssh://[email protected]/~steve.steve/netlify-test.git
user uses netlify init --manual and we create a repo with a bad spec: Repo.path is set to ~steve.steve/netlify-test.git meaning we don't try to reach his server when cloning and fail
user uses netlify sites:create --manual --with-ci and it works correctly, setting Repo.path to [email protected]:~steve.steve/netlify-test.git which works well.
It would appear that init and sites:create are using a slightly different git remote parsing mechanism.
one uses parseGitRemote https://github.com/netlify/cli/blob/master/src/commands/sites/create.js#L119 looks like its working and the other uses getRepoData https://github.com/netlify/cli/blob/master/src/commands/init.js#L61 which appears to not be working
The git remote parsing logic appears to be different for each.
It appears that the parsing logic for netlify sites:create --manual --with-ci is working correctly in the scenario above
The repo_path is added from prompt here https://github.com/netlify/cli/blob/master/src/commands/sites/create.js#L122 in the working path.
It's not added in this https://github.com/netlify/cli/blob/master/src/commands/init.js#L61 init flow
This post was super helpful for me. Using --with-ci allowed me to link CI to a private git repo! Thanks @DavidWells! A way to modify the repo link via UI would be nice.
Hi, this issue with git remote parsing logic remains problematic in some cases. We have an existing production website, self-hosted on a private GitLab and running on Netlify, and we deploy using Netlify CLI. We would like to connect our repository to Netlify to use Deploy Previews but the netlify init --manual command can't reach our GitLab server.
Everything is working fine for our production website so a new site creation is not really an option for us.
I agree with @zachhardesty7, a repository link edit via UI would be very usefull in this case :)
@zachhardesty7 or @Thms-Brnrd can you explain what you mean by "a way to modify the repo link via UI"?
@verythorough if I remember this issue correctly, I ran into the same problem as here. netlify init --manual leaves out the host and username needed for the repo to work. The ability to change the "Repository" link in the /settings/deploys#continuous-deployment settings would at least help mitigate this issue.
Ah, I see what you mean now. However, since that UI field is directly connected to the "automatic" setup for continuous deployment, I think that would actually be a much bigger change than fixing the bug in this issue.
In the end, maintaining two different commands that do essentially the same thing doesn't really make sense. I suspect that the best path forward is to make sure sites:create includes all of the functionality of init and then gradually deprecate init.
@verythorough I agree. Having both commands is mostly just confusing.
Idea: instead of the ability to change the link, creating a CI-enabled site via arbitrary Git URL on the "/start" page would also alleviate the issue. Currently it just shows the big three online repos, but since it appears that Netlify supports any git-based VCS repo, a field to enter a link would be nice.
@zachhardesty7 It turns out we have an internal feature request filed for that very thing! I've added a link to your comment for tracking.