Git Me The URL

2.2.0 · active · verified Thu Apr 16

Git Me The URL is a Python library and command-line tool (CLI) designed to generate sharable links to your Git source code. It currently supports popular Git hosting platforms such as GitHub, GitLab, and Bitbucket. The project, currently at version 2.2.0, maintains an active development status with releases typically focusing on dependency updates, minor enhancements, or internal improvements, including a significant architectural rewrite in version 2.0.0.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize the `GitMeTheURL` object and generate a shareable URL for a file within a local Git repository. The library automatically detects the repository and its remote origin.

import os
from gitmetheurl import GitMeTheURL

# Ensure you are running this code within a local Git repository
# Or provide a specific path to a Git repository
# For demonstration, we assume a file 'my_file.txt' exists in the current repo

gmtu = GitMeTheURL()

# Get a shareable URL for a specific file in the current Git repository
# Replace 'my_file.txt' with an actual file path in your repository
# Example: If running from the root of a repo, use 'README.md'
try:
    url = gmtu.get_source_url('README.md') 
    print(f"Shareable URL for README.md: {url}")
except Exception as e:
    print(f"Error generating URL: {e}")
    print("Please ensure you are in a Git repository and the file path is correct.")

view raw JSON →