Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
git-remote-origin-url
Advanced tools
The git-remote-origin-url npm package is a utility that allows you to retrieve the URL of the 'origin' remote from a Git repository. This can be useful for various automation tasks, CI/CD pipelines, or any scenario where you need to programmatically access the remote URL of a repository.
Retrieve the 'origin' remote URL
This feature allows you to retrieve the URL of the 'origin' remote from the current Git repository. The code sample demonstrates how to use the package to get the URL and log it to the console.
const gitRemoteOriginUrl = require('git-remote-origin-url');
(async () => {
try {
const url = await gitRemoteOriginUrl();
console.log(url);
} catch (err) {
console.error(err);
}
})();
simple-git is a lightweight interface for running Git commands in any Node.js application. It provides a more comprehensive set of Git functionalities compared to git-remote-origin-url, including cloning repositories, committing changes, and more. However, it requires more setup and configuration.
nodegit is a native Node.js library for Git that provides a wide range of Git functionalities. It is more powerful and flexible than git-remote-origin-url, allowing for complex Git operations. However, it has a steeper learning curve and is more resource-intensive.
isomorphic-git is a pure JavaScript implementation of Git that works in both Node.js and browser environments. It offers a broad range of Git functionalities similar to nodegit but is designed to be more lightweight and easier to use. It can be a good alternative if you need cross-platform support.
Get the remote origin url of a git repository.
Install: npm install --save git-remote-origin-url
var originUrl = require('git-remote-origin-url');
originUrl('path/to/repository', function (err, url) {
console.log(url);
// git@github.com:sindresorhus/git-remote-origin-url.git
});
MIT License • © Sindre Sorhus
FAQs
Get the remote origin URL of a Git repository
The npm package git-remote-origin-url receives a total of 1,817,678 weekly downloads. As such, git-remote-origin-url popularity was classified as popular.
We found that git-remote-origin-url demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.