Android Studio Checkout Github Error "CreateProcess=2" (Windows) - github

Today I've tried to checkout my Github project using brand new Android Studio and ended up with this nasty error :
Why things just never work out of the box ...?

I've solved the problem , and I will explain how :
Download Github For Windows client and install it.
After The client successfully installed , connect it with your github account.It should be easy , just follow the wizard.
Then you should add git.exe location to your "Path Variable". The location you should add will probably be something like :
C:\Users\Your_Username\AppData\Local\GitHub\PortableGit_ca477551eeb4aea0e4ae9fcd3358bd96720bb5c8\bin
Alternatively , if you don't want to add to environment variables. You can open the android studio and go to :
Settings -> Version Control -> Git
In text box next to "Path to Git Executable" you will see "git.exe" , just give it a full path like so :
C:\Users\Your_Username\AppData\Local\GitHub\PortableGit_ca477551eeb4aea0e4ae9fcd3358bd96720bb5c8\bin\git.exe
EDIT :
For latest Github for windows versions some can find the git.exe under "...\cmd\git.exe" rather than "...\bin\git.exe".

I found what I think is a faster solution.
Install Git for Windows from here: http://git-scm.com/download/win
That automatically adds its path to the system variable during installation if you tell the installer to do so (it asks for that). So you don't have to edit anything manually.
Just close and restart Android Studio if it's open and you're ready to go.

I am using Windows 10 OS and GitHub Desktop version 1.0.9.
For the new Github For Windows, git.exe is present in the below location.
%LOCALAPPDATA%\GitHubDesktop\app-[gitdesktop-version]\resources\app\git\cmd\git.exe
Example:
%LOCALAPPDATA%\GitHubDesktop\app-1.0.9\resources\app\git\cmd

If you have downloaded Github Desktop Client 1.0.9 then the path for git.exe will be
C:\Users\Username\AppData\Local\GitHubDesktop\app-1.0.9\resources\app\git\cmd\git.exe

I faced same issue in android studio 3.2.1, solved the issue by setting git path in System Environment variable
C:\Program Files\Git\bin\,C:\Program Files\Git\bin\
And I imported the project once again and solved the issue!!!
Note : Check your android studio git settings has properly set the correct path to git.exe

Steps:
1) Download git for windows https://git-scm.com/downloads
2) Install downloaded git with default setup
3) From Android Studio close if any project is open then Click on Configure -> Settings -> Version Control -> Git
4) Change Path to Git executable : git.exe to C:\Program Files\Git\cmd\git.exe
5) Apply and Ok
6) Try to clone from Check out project from Version Control
7) Done

for Android Studio 3.0.1, you can config GitHub path for following path:
File > Setting > Version Control
List item
Click "+" on the top-right conor to open "Add VCS Directory Mapping"
Click "Configure VCS" to open "Version Control Configurations"
Click "Git" then you'll see Path to Git executable]
Input : C:\Users[you user name]\AppData\Local\GitHub\PortableGit_d7effa1a4a322478cd29c826b52a0c118ad3db11\cmd\git.exe
Test it
enter image description here

I encountered a similar error with RubyMine 2016.3 recently, wherein any attempts at checkout or export to Github were met with "Cannot run program 'C:\Program Files (x86)\Git\cmd\git.exe': CreateProcess error=2, The system cannot find the file specified"
As an alternative solution for this problem, other than editing the Path system variable, you can try searching through the program files of Android Studio for a git.xml file and editing the myPathToGit option to match the actual location of git.exe on your computer. This is how I fixed this similar issue in RubyMine.
Posting this solution here for the sake of posterity.

I had this issue on Mac. I simply quit Android Studio and restarted it, and for some reason had no further issues.

Related

VS Code's file changes watcher stopped working

I have vsc version 1.63.2. I'm getting the following notification:
"File changes watcher stopped unexpectedly. A reload of the window may enable the watcher again unless the workspace cannot be watched for file changes."
When I click the reload button, the issue is temporarily fixed and Source Control shows changes to my files. Git in CLI is working fine; git log --raw shows changes to my files correctly. I've tested brand new and old repositories and workspaces. The problem occurs in all of them. Any help troubleshooting this is greatly appreciated!
I just ran into this issue today and found my solution by viewing the "Window" logs using the "Developer: Open Log File..." command from the Command Palette.
In my case, the problem was that I had added a folder to my workspace that I had since deleted on the file system. The log in question looked something like:
... [error] [File Watcher (parcel)] Unexpected error: Invalid handle (EUNKNOWN) (path: \path\that\no\longer\exists)
... [error] [File Watcher (parcel)] restarting watcher after error: Invalid handle
Hopefully viewing this log helps you find out what's breaking in your specific case.
I also encountered this problem. I was using VSCode and opening a folder in it on WSL Ubuntu 20.04. The solution for me was to install the VS Code Remote - WSL extension.
I hope this will be useful for someone.
TLDR : on Windows 10, if you have Cygwin64 installed and you got a Git For Windows update, check Git for Windows path comes before Git from Cygwin path in environment variables.
Long version : Just got into the same error today. The Git Lens extension was not working anymore.
I'm on Win 10, so there is no way (at least I didn't find one) to increase the limit of watchers like on linux. My VS Code is v1.66.2, Git Lens extension is v12.0.6.
In my case, the logs said :
... [error] [File Watcher (parcel)] Unexpected error: Invalid handle (EUNKNOWN) (path: cygwin\g\path\that\exists)
Notice that ENOSPC !== EUNKNOWN
So I searched everywhere with little to no success, except here where Gordon Christopher Weeks's answer actually hinted me towards that logs.
Then I remembered several things :
I have a terminal installed that's called cygwin64 and that allows me to use some linux utilities otherwise not available on Win (like rsync);
two days ago, I authorized an update for Git for Windows (2.35.2);
when I installed cygwin, the tutorial I followed told me about following a certain sequence in the Windows path environment variable
So I checked the path variable, noticed the Git update deleted the initial path to git and put it in the last place. I only had to move it up, before the cygwin64 path to git.exe (a git utility is included with cygwin) and everything's back to normal.
Hope this helps and so you won't waste the time I did !
[Possible quick solution] First thing to check is to see if you are tracking a WSL folder in a Visual Studio Code Explorer workspace AND you switched VS Code back to windows (was in a WSL distro).
If so, then right-clicking on it and selecting "remove from workspace" will also remove it from the file change watcher.
Refresh the file change watcher (bell icon, lower right corner of window) to see if it cleans up the problem.
This was the issue I had with the system.

GitHub clone to desktop uses TortoiseGit instead of GitHub Desktop

When i try to clone a repository to desktop the default app for cloning has suddenly became TortoiseGit instead of GitHub. Anyone with a fix?
The following fix is a permanent solution for this issue that also withstands TortoisGit-updates/repairs.
It adds GitHubDesktop's protocol-associations the way described in https://learn.microsoft.com/en-us/windows/win32/shell/default-programs.
Add to the registry (You can save this content as .reg file and double-click it to auto-import these keys into registry):
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\GitHubDesktop]
[HKEY_LOCAL_MACHINE\SOFTWARE\GitHubDesktop\Capabilities]
[HKEY_LOCAL_MACHINE\SOFTWARE\GitHubDesktop\Capabilities\UrlAssociations]
"github-windows"="github-windows"
"x-github-client"="x-github-client"
[HKEY_LOCAL_MACHINE\SOFTWARE\RegisteredApplications]
"GitHubDesktop"="Software\\GitHubDesktop\\Capabilities"
Reboot or on a windows-server sign-out and log-in.
The next time a project is cloned from github, a message-box popped-up asking to pick an app.
GitHubDesktop will now also be available in the Windows settings: Choose default apps by protocol. So it can be recovered with Windows settings, if TortoisGit (or another app) was chosen as default handler for GitHub-clone.
I also opened a new error at GitHubDesktop-development: https://github.com/desktop/desktop/issues/8258
There was a bug in 2.6.0 which made TortoiseGit the default if the github handler was enabled on installation.
To fix this, go to the default programs settings in Windows, open the file-type associations dialog and set github-windows and x-github-client back to the official github client. Maybe you have to update to TortoiseGit 2.7.0 first.
cf. https://www.thewindowsclub.com/change-file-associations-windows
You could try whether the hard way works: (Store this as a .reg file and import it, you need to madjust the paths)
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\github-windows]
[HKEY_CLASSES_ROOT\github-windows]
"URL Protocol"=""
#="URL:github-windows"
[HKEY_CLASSES_ROOT\github-windows\shell\open\command]
#="\"C:\\Users\\USERNAME\\AppData\\Local\\GitHubDesktop\\app-1.4.2\\GitHubDesktop.exe\" --protocol-launcher \"%1\""
[-HKEY_CLASSES_ROOT\x-github-client]
[HKEY_CLASSES_ROOT\x-github-client]
"URL Protocol"=""
#="URL:x-github-client"
[HKEY_CLASSES_ROOT\x-github-client\shell\open\command]
#="\"C:\\Users\\USERNAME\\AppData\\Local\\GitHubDesktop\\app-1.4.2\\GitHubDesktop.exe\" --protocol-launcher \"%1\""
change windows registry is not working.
I have met the same problem and the registry is all right,but github desktop wont come out.
As a software developer,I used url protocol once.I cannt understand why Windows setting is not related to the ROOT registry . I would appreciate a comment.
here is how i solve the problem:
After uninstall tortoise and reinstall github. Chrome works fine.
When you install tortoise,be careful with this setting:
but even if you unchecked this,x-github-client is registed to tortoisegit client again.
You can check it in your windows setting of default apps - choose default apps by protocal.
So i think this is a bug for tortisegit.
I use tortoisegit 2.7.0 and win10 1809.
If you really want github desktop to popup , you should not install tortoisegit
This is based on tobias.loew answer:
If you don't have this line at the start:
Windows Registry Editor Version 5.00
Script won't compile
Create github.reg file:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\GitHubDesktop]
[HKEY_LOCAL_MACHINE\SOFTWARE\GitHubDesktop\Capabilities]
[HKEY_LOCAL_MACHINE\SOFTWARE\GitHubDesktop\Capabilities\UrlAssociations]
"github-windows"="github-windows"
"x-github-client"="x-github-client"
[HKEY_LOCAL_MACHINE\SOFTWARE\RegisteredApplications]
"GitHubDesktop"="Software\\GitHubDesktop\\Capabilities"
Put this in a file called github.reg and then double click it.

Show git branch in Visual Studio Code

I have a project folder structure like this : Code/Repo/<repo_folder_name>/..subfolders and in the <repo_folder_name> i have the hidden .git folder because i cloned from Sourcetree to this folder .
Eclipse does show the current branch , but when i open this folder in Visual Studio Code , i know it must show the current branch name , in the bottom left side .
Does anybody know how to do this ? To show the branch name in Visual Studio Code ?
Thank you very much.
-- > I added Sourcetree`s bin folder to the PATH and now everything is working ok :D . Sourcetree uses embed git so you have to add it to the window path
Assuming you have git installed all you do is go to View->Show Status Bar (as seen below). It will then show your current branch on the bottom of your current editor window.
For windows:
The easiest thing would be to change your integrated terminal shell from Powershell to Git Bash. You can do that by going to File > Preferences > Setting and changing the integrated terminal shell, as illustrated below:
For mac navigate to:
Code> Preferences> settings> Search for 'terminal'
In the docs it says:
Note: VS Code will leverage your machine's Git installation, so you
need to install Git first before you get these features. Make sure you
install at least version 2.0.0.
So there needs to be a Git on your system to get it working. Using the embedded Git from your Sourcetree installation will probably work, but might not be the cleanest solution. The Git in my Sourcetree installation (on a Mac) is about 3 years old (2.2.1). On a Mac there is also a Git preinstalled though (2.11.0), so here it works out of the box.
It's not clear if you're looking for display on the command-line [prompt] or in the VSCode UI.
There's this alternative view provided by the sidebar plugin that fits the bill when the Source Control Repositories option is checked (right-click on the topmost Source Control header):
UI branch controls!
In year 2022
From top menu, select and check View > Appearance > Status bar
Status bar appears at bottom of VS Code Window
Branch displays in Status bar on left-side
If you would also like to show the working branch in the Visual code Terminal Window, Try installing posh-git from chocolatey, you get all the git summarycolor codings and tab completion with the branch name in highlighted colors. If you are running a Powershell version less than 6, make sure to set execution policies above Restricted.

VS Code Error: spawn git ENOENT

I get the error Error: spawn git ENOENT when I try to view git history using https://github.com/DonJayamanne/gitHistoryVSCode on VS Code.. I'm very new to VS Code and github. I tried googling for solutions but I only found links about node.js which I don't understand at all..
We need to install Git to use the Git History (git log) extension in VS Code.
Otherwise we will see this when running git log.
If you have already installed Git, then make sure that it is available from the shell, for example by typing git --version.
Once you have Git installed properly, you will see this when running git log.
That means you need to set environment variable in system for git. After you set it well, the issue will disapper.
If your OS is Windows:
Try typing "git --version" in the system command line (do not use git bash by mistake). If you cannot see the version, it indicates that git is not added to the environment variables.
For example, my Git is installed on the disk "C:\", I need to add "C:\Program Files\Git" to the path of the environment variables.
Method 1:
Steps:
Edit environment variables -> System Variables
Edit Path,
add
;C:\Program Files\Git\bin\git.exe;C:\Program Files\Git\cmd;
to current value of Path (remove the beginning ; if redundant).
You need to adjust this file path according to your actual directory where git is installed.
Then restart your command line, and then try typing "git --version" again. If you can see python version now, try your vs code again, the issue you metioned will disappear.
Another method:
Reinstall your visual studio code with checking "Add to PATH (available after restart)".
I had the same issue on MacOS (running VS Cod 1.26.1). With difference to other info that I had found, I worked only after setting:
"git.path": "/usr/local/bin/git"
No success setting the path to null or any other.
I just got this error while trying to use the Worktrees tab from the GitLens extension. With git worktree list I found out I had some prunable worktrees, so it worked again after I ran this:
git worktree prune
In Mac OS you have to modify your settings.json. For me currently located in Users//Library/Application Support/Code/user/settings.json
or what it is the same ~/Library/Application Support/Code/user/settings.json
There set "git.path": "/usr/local/bin/git",
You can achieve the same inside Visual Studio Code going to the "Settings" Gear Icon > Settings Then search for git. Under Extensions go to Git and look for Path Click on Edit in settings.json
It will open the same file inside the editor
See the image for VSCODE
install git, and run git init
If you are getting this error from a React app created using Create React App, i.g. create-react-app nameOfYourApp, you need to setup CircleCI environment. More info here https://facebook.github.io/create-react-app/docs/running-tests
On your own environment
Windows (cmd.exe)
set CI=true&&npm test
set CI=true&&npm run build
(Note: the lack of whitespace is intentional.)
Windows (Powershell)
($env:CI = "true") -and (npm test)
($env:CI = "true") -and (npm run build)
Linux, macOS (Bash)
CI=true npm test
CI=true npm run build

"No extensions found" when running Visual Studio Code from source

When I try to install any extension in Visual Studio Code (i.e., by pressing Ctrl+P and then running ext install RustyCode), I get a message that No extensions found.
However, this only happens when I run VS Code directly from source repository. I.e., after:
git clone https://github.com/Microsoft/vscode.git
cd vscode
git checkout 1.0.0
scripts/code.sh
But, if I run VS Code from official builds, then I'm able to install extensions.
So, how can I enable downloading and installing extensions from Visual Studio Marketplace when I run VS Code directly from source repository? (Is Visual Studio Marketplace integration bundled separately in official builds?)
I'm on Ubuntu/Linux.
This can be fixed by adding following to product.json:
"extensionsGallery": {
"serviceUrl": "https://marketplace.visualstudio.com/_apis/public/gallery",
"cacheUrl": "https://vscode.blob.core.windows.net/gallery/index",
"itemUrl": "https://marketplace.visualstudio.com/items"
}
(This is can also be fixed by copying product.json from an official build (in the .zip archvie, product.json is under resources/app) which contains above lines).
More information: https://github.com/Microsoft/vscode/issues/1557
You can use code-marketplace extension in AUR to add microsoft marketplace registery in code OSS. This extension will installs a pacman hook that patches the file on every package update.
If you want to do the same for archlinux, have a look here => https://wiki.archlinux.org/index.php/Visual_Studio_Code , you have various possible options to solve the problem.
For Arch linux you could access the product.json file under this path - /usr/lib/code/product.json.
Just edit on the file the extensionsGallery with the following-
"extensionsGallery": {
"serviceUrl": "https://marketplace.visualstudio.com/_apis/public/gallery",
"cacheUrl": "https://vscode.blob.core.windows.net/gallery/index",
"itemUrl": "https://marketplace.visualstudio.com/items"
}
like #Vikrant Chaudhary said.
Extending the answer from #Vikrant Chaudhary. If anyone wanted to do the same thing on Windows, the path to product.json is here:
Windows path for VSCodium: C:\Program Files\VSCodium\resources\app\product.json