Clone git repository UPDATE

Sometimes the most useful things in life are the most simple ones. In other words for me I use this script all the time and I find it very useful and maybe for you too.

For any developer who clone git repository from GitHub.

  1. Safari URL target git repository
  2. Run the script from Script Menu
  3. On the local machine you will have a clone of git repository

I have update my old script to include a alert…

(**
* Description: Clone git repository from the URL in current tab in Safari.
*)

property localFolder : POSIX path of (path to documents folder) & "GitHub/"

on run
	tell application "Safari"
		set thisDocument to document of front window
		set thisURL to URL of thisDocument
	end tell
	
	set thePath to localFolder
	set shellCommand to do shell script "git -C " & quoted form of thePath & space & "clone" & space & thisURL & "; echo $?"
	if not shellCommand = "128" then
		display alert "Success..."
	else
		display alert "Check if the local folder exists in the parent folder: " & thePath
	end if
end run
1 Like