Skip to content

Fix remote tracking does not support SSH#256

Merged
VikramGoyal23 merged 15 commits intogit-mastery:mainfrom
SAN-MUYUN:enhancement/HTTPS-and-SSH-auth
Feb 5, 2026
Merged

Fix remote tracking does not support SSH#256
VikramGoyal23 merged 15 commits intogit-mastery:mainfrom
SAN-MUYUN:enhancement/HTTPS-and-SSH-auth

Conversation

@SAN-MUYUN
Copy link
Contributor

Fixes #244

So far, only the hands-ons are affected. Exercises are not affected until Tour 8, where pushing to remote repo is required.
List of updated hands-ons are listed in the Incident Review below.

Solution:
Implemented method get_github_git_protocol to obtain the GitHub preferred protocol (https or ssh)
Implemented method get_remote_url to get the correct remote url for a repo.
get_remote_url calls get_github_git_protocol to check for the protocol that user is using, before configuring the url accordingly.

for some hands-ons where forking is required, and we push to the forked repo:

  • use clone_repo_with_gh
  • remove the upstream with remove_remote("upstream", verbose)

for hands-on where we have to do git remote add origin manually:

  • obtain the correct remote url using get_remote_url before adding it manually.

Tested using both https and ssh protocol, no unexpected behavior so far.

refer to this Incident Review for details

@github-actions
Copy link

github-actions bot commented Feb 1, 2026

Hi @SAN-MUYUN, thank you for your contribution! 🎉

This PR comes from your fork SAN-MUYUN/git-mastery-exercises on branch enhancement/HTTPS-and-SSH-auth.

Before you request for a review, please ensure that you have tested your changes locally!

Important

The previously recommended way of using ./test-download.py is no longer the best way to test your changes locally.

Please read the following instructions for the latest instructions.

Prerequisites

Ensure that you have the gitmastery app installed locally (instructions)

Testing steps

If you already have a local Git-Mastery root to test, you can skip the following step.

Create a Git-Mastery root locally:

gitmastery setup

Navigate into the Git-Mastery root (defaults to gitmastery-exercises/):

cd gitmastery-exercises/

Edit the .gitmastery.json configuration file. You need to set the following values under the exercises_source key.

{
    # other fields...
    "exercises_source": {
        "username": "SAN-MUYUN",
        "repository": "git-mastery-exercises",
        "branch": "enhancement/HTTPS-and-SSH-auth"
    }
}

Then, you can use the gitmastery app to download and verify your changes locally.

gitmastery download <your new change>
gitmastery verify

Checklist

  • (For exercises and hands-ons) I have verified that the downloading behavior works
  • (For exercises only) I have verified that the verification behavior is accurate

Important

To any reviewers of this pull request, please use the same instructions above to test the changes.

@VikramGoyal23 VikramGoyal23 self-requested a review February 4, 2026 07:00
@jovnc
Copy link
Collaborator

jovnc commented Feb 5, 2026

@VikramGoyal23 Are you reviewing this PR?

If you're not free, someone else can also review it so that we don't block on this. Let's avoid self-requesting reviews and leaving it hanging.

Copy link
Collaborator

@VikramGoyal23 VikramGoyal23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just some minor nits! I can add these via the GitHub GUI.

"""returns GitHub CLI's preferred Git transport protocol"""
result = run(["gh", "config", "get", "git_protocol"], verbose)
if result.is_success():
protocol = result.stdout.splitlines()[0]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just in case, can we add a strip() after [0]?


def _setup_local_repository(verbose: bool):
os.makedirs("things")

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This extra whitespace seems unnecessary, did your linter add this in?

@VikramGoyal23 VikramGoyal23 merged commit 8dff43c into git-mastery:main Feb 5, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remote tracking does not support SSH

3 participants