Launch Week Day 5: Introducing Reachability for PHP.Learn More
Socket
Book a DemoSign in
Socket

parse-git-url

Package Overview
Dependencies
Maintainers
7
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parse-git-url

A lib for parsing the URL of Git Repositories.

latest
Source
npmnpm
Version
1.4.0
Version published
Weekly downloads
159K
-38.8%
Maintainers
7
Weekly downloads
 
Created
Source

parse-git-url

A lib for parsing the URL of GitHub, GitHub Enterprise Server (ghes), GitLab, and Bitbucket repositories.

Usage

import parseGitUrl from 'parse-git-url'

parseGitUrl('https://github.com/vercel/swr')
// => {
//   type: 'github',
//   owner: 'vercel',
//   name: 'swr',
//   branch: '',
//   sha: '',
//   subdir: ''
// }

parseGitUrl('https://github.example.com/vercel/swr', 'github.example.com')
// => {
//   type: 'ghes',
//   owner: 'vercel',
//   name: 'swr',
//   branch: '',
//   sha: '',
//   subdir: ''
// }

parseGitUrl('https://google.com')
// => null

It supports parsing various URL schemas including SSH, branch, sha, commit, subdirectories, subgroups (GitLab), etc.

Author

Shu Ding (@shuding_) – Vercel

FAQs

Package last updated on 14 Aug 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts