Skip to content

Cannot add a remote repository through settings UI #746

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
cambot opened this issue Apr 18, 2025 · 4 comments
Open

Cannot add a remote repository through settings UI #746

cambot opened this issue Apr 18, 2025 · 4 comments

Comments

@cambot
Copy link

cambot commented Apr 18, 2025

I'm using v2.10 of the module. I ran do ##class(SourceControl.Git.API).Configure() and chose the option to first initialize an empty repository. (I made a few test commits locally to get familiar with the UI.

When I went to connect my local repo to a remote, I realized that not only does the Settings UI not actually save the value I put into the "Remote Repository" setting, but it also does not set up a new remote in the local git config: git remote origin add [url]. (If I manually configure the remote with git remote add origin ..., the settings page does pick that up.)

I would also recommend 2 additional things:

  • First, make sure there isn't already an origin defined, so you do not accidentally clobber an existing value. (just in case the UI had a stale config)
  • A non-destructive test of the remote config.
    • My initial thought is using git branch --remote. If the url is correct (and the ssh config has been setup correctly?), it should list out all the branches available on the remote.
    • Caveat: when I tested this manually, I noticed that if the remote is a bare repo, git branch --remote simply returns nothing.
    • An alternative could be a git fetch origin which should update all the remote refs without altering the state of local branches.
@isc-pbarton
Copy link
Collaborator

Thank you for logging this and for your suggestions!

Breaking this down a little bit with suggestions (let us know if this doesn't match your experience):

  • Bug: If I initialize an empty repository without a remote, then try to add a remote through the settings page, it fails silently with "error: No such remote 'origin'". We should fix so it adds the remote (and reports any errors back to the user).
  • Bug: If the origin remote does exist and I try to use the settings page to change it, the remote is updated but the settings page reverts back to the old value. If I reload the page it does show the new value.
  • Enhancement: add a confirmation dialog if you are changing the remote through the settings page. This should clarify that there is an existing "origin" remote repository that is being changed to the new URL.
  • Enhancement: test connection to the remote repository if you are changing the remote through the settings page. Display a warning if we are not able to connect.

Related issue: #375

@cambot
Copy link
Author

cambot commented Apr 18, 2025

@isc-pbarton , For the first bug you list:

Bug: If I initialize an empty repository without a remote, then try to add a remote through the settings page, it fails silently with "error: No such remote 'origin'". We should fix so it adds the remote (and reports any errors back to the user).

the current version does not even attempt to add the remote (as far as I can tell). I don't even get an error... only "Settings successfully saved".

For the second bug you list, I did not attempt to update an existing remote repository value (Say to simulate correcting a typo). I did find myself manually reloading the page just to be certain I was looking at the current config. I get wanting to track New vs Update scenarios.

@cambot
Copy link
Author

cambot commented Apr 18, 2025

I just found SourceControl_Git.Log and it appears to be doing something under the hood to setup/test the remote, but it is not communicating errors back through the UI. It is possible that it's having problems because I also did not configure an SSH key right away, but even after I configured a valid key, it still did not tell me anything.

I did try first configuring an existing SSH key, but that still did not allow me to configure the remote through the settings UI. (again, no helpful feedback provided through the settings page)

Another UX point: I noticed that if I define an invalid key file, I get a button that looks like it should help me set up an SSH key. I think it would be helpful to also provide this when no key is defined (in addition to the help text that is already there). This is another on-boarding point that I can see as a frustration/blocker for an inexperienced git user.

(between manually configuring my remote and setting an SSH key through the UI, I was eventually able to push commits to a remote repository. My initial issue that the settings page is unclear when there are issues still stands.)

@cambot
Copy link
Author

cambot commented Apr 21, 2025

For what it's worth, when I run do ##class(SourceControl.Git.API).Configure() and provide my SSH key at the prompt, the script did successfully clone a repository to my local machine (I confirmed this from both github and bitbucket with a valid key configured in both)

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

No branches or pull requests

2 participants