Repository URL not appearing because "git@" or "http(s)" is hardcoded in matching logic
See original GitHub issueIf the repository URL isn’t formatted to a very hardcoded format, the “View repository” button won’t appear.
The issue is around here in utils.ts
:
const matched =
/^(?:git@|https?:\/\/)(?<provider>[a-zA-Z_.~-]+\.[a-z]{2,})(?::|\/)(?<user>.*?)\/(?<repo>.*)$/.exec(
remoteUrl.stdout.trim()
);
It is not always applicable that the SSH user is git
, or that the SSH user is specified in the URL on the machine. Namely, you can configure in your SSH config:
Host mygithost.com
HostName mygithost.com
User gitolite
Port 4022
and then use mygithost.com:user/repo
(or /repo.git
) in the config of the local repository.
It is still highly likely that http://mygithost.com/user/repo
is still valid in this context and leads to the repository.
Alternatively, a config option (on a per-repo level) where you could specify which URL to open, side-stepping the entire problem.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:13 (7 by maintainers)
Top Results From Across the Web
Github repository code is not matching live website
I've pushed changes to my html file to change a URL, but the changes are not showing up on the live website. I...
Read more >Protect and discover secrets using Gitleaks - GitHub
Gitleaks is a SAST tool for detecting and preventing hardcoded secrets like ... repos: - repo: https://github.com/zricethezav/gitleaks rev: v8.12.0 hooks: ...
Read more >Updating to Git 1.8.1 - Wincent
When "git push [$there]" does not say what to push, we have used the traditional "matching" semantics so far (all your branches were...
Read more >Troubleshooting Geo - GitLab Docs
Ensure the URL field matches the value found in /etc/gitlab/gitlab.rb in external_url "https://gitlab.example.com" on the Rails nodes of the secondary site.
Read more >Control Freak for Bitbucket Server - Documentation
Enforce Git best practices in all your repositories. ... Author "Admin <admin@bit-booster.com>" does not exactly match remote: a Bitbucket user record.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Alright, can confirm it works now properly! (As in, sans the Discord bug.)![Hang on! This link will take you to . Are you sure you want to go there?](https://user-images.githubusercontent.com/1969470/130932511-12b96255-8fc6-447c-8ac2-6e4837387b26.png)
I’ve found this library, written in pure JavaScript: https://github.com/IonicaBizau/git-url-parse. Perhaps you could use this to parse all the components of the remote URL in a portable way, and use the resulting struct to build the URL sent to Discord.