extensions icon indicating copy to clipboard operation
extensions copied to clipboard

[Github] Unable to clone and open new repositories using hotkey

Open MarcoLucke opened this issue 11 months ago • 6 comments

Extension

https://www.raycast.com/raycast/github

Raycast Version

1.88.3

macOS Version

15.2

Description

Can't Clone and Open a new repository in GitHub search-repositories error: image

worked before seems broken since latest Mac OS or Raycast Extension Update Path to Clone into is set as before: image

manually cloning via gh cli works

Steps To Reproduce

Open Raycast Use Search Repositories from GitHub extension Select a new repository that's not in you local storage press opt + cmd + c to "clone and open"

Current Behaviour

Can't clone new repositories with clone and open command pulling existing repositories works fine

Expected Behaviour

need to be able to clone non existing repositories via clone and open again

MarcoLucke avatar Dec 18 '24 10:12 MarcoLucke

Thank you for opening this issue!

🔔 @unnamedd @tonka3000 @khasbilegt @pernielsentikaer @loxygenK @oilbeater @LunaticMuch @aeorge @daquinoaldo @peppy @aeither @marcotf @qeude @nesl247 @xilopaint @antonengelhardt @bangerang @wottpal @LitoMore @d-mitrofanov-v @j3lte @jfkisafk @vlasischar @JavaLangRuntimeException @shyakadavis @sushichan044 you might want to have a look.

💡 Author and Contributors commands

The author and contributors of raycast/github can trigger bot actions by commenting:

  • @raycastbot close this issue Closes the issue.
  • @raycastbot close as not planned Closes the issue as not planned.
  • @raycastbot rename this issue to "Awesome new title" Renames the issue.
  • @raycastbot reopen this issue Reopens the issue.
  • @raycastbot assign me Assigns yourself to the issue.
  • @raycastbot good first issue Adds the "Good first issue" label to the issue.
  • @raycastbot keep this issue open Make sure the issue won't go stale and will be kept open by the bot.

raycastbot avatar Dec 18 '24 10:12 raycastbot

Could you share a recording? It'll make it easier to see what's happening.

thomaslombart avatar Jan 09 '25 10:01 thomaslombart

https://github.com/user-attachments/assets/e0b29b07-8c38-440c-824e-1350cabbeaf6

MarcoLucke avatar Jan 13 '25 08:01 MarcoLucke

as you can see im trying to "Clone And Open" a Repo that is not currently in my local file system. This ends in the error: image

my Clone Path is set as usual, nothing changed there: image

MarcoLucke avatar Jan 13 '25 08:01 MarcoLucke

And when I execute the same command manually it works as intended. Seems as if "Clone And Open" doesn't use the configured folder anymore.

image

MarcoLucke avatar Jan 13 '25 08:01 MarcoLucke

Yes, the Raycast process (and the child process it spawns) does not have permissions to create a folder in the file system.

export async function cloneAndOpen(repository: ExtendedRepositoryFieldsFragment) {
  const { application, baseClonePath, repositoryCloneProtocol } = getPreferenceValues<Preferences.SearchRepositories>();
  console.log("baseClonePath", baseClonePath);
  const applicationPath = application?.path.replaceAll(" ", "\\ ");
  const clonePath = `${baseClonePath}/${repository.nameWithOwner}`;
  console.log("clonePath", clonePath);
  const openCommand = `open -a ${applicationPath} ${clonePath}`;

  // ...

  if (!existsSync(clonePath.replace("~", homedir()))) {
    const cloneCommand = buildCloneCommand(repository.nameWithOwner, repositoryCloneProtocol);

    try {
      execSync(cloneCommand);
    } catch (error) {
      toast.style = Toast.Style.Failure;
      toast.title = "Error while cloning the repository";
      toast.message = getErrorMessage(error);
      console.error(error);
      return;
    }
  }

// ...
export const buildCloneCommand = (
  repoNameWithOwner: string,
  cloneProtocol: AcceptableCloneProtocol,
  options?: Partial<AdditionalCloneFormatOptions>,
): string => {
  const gitFlag = options?.gitFlags?.join(" ") ?? "";
  const targetDir = options?.targetDir ?? "";

  const cloneUrl = formatRepositoryUrl(repoNameWithOwner, cloneProtocol);
  return `git clone ${gitFlag} ${cloneUrl} ${targetDir}`;
};
[0] 11:06:18.520 baseClonePath /Users/antonengelhardt/Documents/repos
[0] 11:06:18.520 clonePath /Users/antonengelhardt/Documents/repos/raycast/ripgrep
[0] 11:06:18.619 Error: Command failed: git clone  https://github.com/raycast/ripgrep.git 
[0] fatal: could not create work tree dir 'ripgrep': Read-only file system

antonengelhardt avatar Jan 13 '25 10:01 antonengelhardt

I've looked at it, and I can reproduce it indeed. Using the Clone with Options form seems to work though, so there's probably something in the Clone and Open action that's not been updated or doesn't work. Would one of you be able to look at it? I'm busy with other projects at the moment, so it's hard to dedicate some time to that.

thomaslombart avatar Jan 17 '25 10:01 thomaslombart

@thomaslombart I will take a look.

LitoMore avatar Jan 17 '25 10:01 LitoMore