cli icon indicating copy to clipboard operation
cli copied to clipboard

semantic-release-cli setup could not get repository url

Open deployn opened this issue 2 years ago • 1 comments

I encountered an error while running the command $ npx semantic-release-cli setup on my project. During the process, I received the following error message: ERR! semantic-release Could not get repository url. Please create/add the repository. even while having a remote repository set up. After investigating further, I realized that the issue was related to the remote repository not being named ‘origin’.

Renaming the remote to ‘origin’ resolved the problem for me.

However, it would be beneficial if the semantic-release-cli tool could analyze other remotes as well, or if the error message could provide more specific information about the cause of the issue such as ERR! semantic-release Could not get repository URL. Please create/add the repository as the remote named ‘origin’.

deployn avatar Aug 20 '23 18:08 deployn

Yes, you are correct. The CLI package automatically looks for origin remote.

https://github.com/semantic-release/cli/blob/0421ca50b4ed7f1369eb2d7ac036816db6004025/src/lib/repository.js#L17

Naming the primary remote in Git as "origin" is a widely followed convention. When you clone a repository from a remote server, Git automatically names it "origin" for you. This helps keep consistency across different projects.

The "origin" name is so widely used that many developers will automatically understand what it refers to, so I don't believe that this will be changed because it's so ubiquitous.

seebeen avatar Aug 20 '23 23:08 seebeen