Git annex installation on Windows - windows

I have installed git and git-annex on my Windows 8 to use with git bash. Git is ok, but git bash could not find git annex at first. I restarted my computer and now when it turns on a message pops up saying it cannot find git-annex-autostart.vbs. However the file is indeed at the path the start up script is looking for (C:\Program Files (x86)\Git). Any suggestions?

Answer found: just had to find git-annex.exe (look for the cmd folder under your git installation) and add to PATH:
$ export PATH=$PATH:/c/Program\ Files\ \\(x86\\)/Git/cmd/./

Related

How to change the command base in Git Bash in VS Code?

I'm learning to use Git. After installation I can open a Bash terminal on VS Code (I'm using Windows if that's relevant). Right after opening a Bash terminal, this command shows up automatically (the id and path are masked for privacy):
myid#machineid MINGW64 /c/Users/...
$ source C:/ProgramData/Anaconda3/Scripts/activate base
(base)
I guess it means it's using Anaconda to run the Git command. However, it appears many CMD commands that otherwise work normally in a Windows terminal don't work. For example, I can't create a new folder. This error comes up:
$ mkdir test
bash: /c/ProgramData/Anaconda3/Library/usr/bin/mkdir: Permission denied
(base)
Similarly, commands like ls or touch just don't work. But I find pwd works. I look at /c/ProgramData/Anaconda3/Library/usr/bin and see there are a bunch of CMD command exe files in there, such as mkdir.exe, rm.exe. I also look at the Git installation directory and find a folder with similar exe commands (C:\Program Files\Git\usr\bin)
On the other hand, I can still use Git commands. So this works (after manually creating the folder test):
$ git init
Initialized empty Git repository in C:/Users/.../test/.git/
(base)
Also, if I don't use VS Code, but use a Git CMD then everything works just fine.
So the question is how I can fix it? More specifically, how can I direct Git to use Git command base in VS Code instead of depending on Anaconda base? What it currently means to me is that if I uninstall Anaconda then Git may not work in VS Code at all.

GIT Issue on Windows (The filename or extension is too long)

Overview:
Just installed the GIT version 2.20.1-64-bit on my Windows 7 platform. Git works well on GIT Bash; but, any git command on Windows CMD or Powershell raises The filename or extension is too long error.
Details:
GIT version: 2.20.1-64-bit
Platform: Windows 7
Troubleshooting Efforts:
I tried switching longpaths attribute to true based on Filename too long in Git for Windows. I also googled to find other solutions but all recommended the same approach which was updating the git config.
The GIT config file updated with git config --system core.longpaths true
Issue:
Any Git command via Windows CMD or 3rd party apps like IntelliJ Idea raises the following error:
CMD:
IntelliJ:
Please advise me with your genuine solutions.
I had the same problem. I then installed it in my user folder and now it works. It seems to be a privilege issue. Git gets installed as admin in C:\Program Files\Git but then can't write to these files because it is run as a user.
Also using the portable version should fix the problem.
Try first to use a simplified PATH and a portable Git (like PortableGit-2.20.1-64-bit.7z.exe) uncompressed anywhere you want.
set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\
set GH=C:\path\to\git
set PATH=%GH%\bin;%GH%\usr\bin;%GH%\mingw64\bin;%PATH%
Then check if the issue persists in that CMD session, where you have set said simplified PATH.

How to install Git Large File Storage on Windows?

According to its doc, double-click should be enough. But when I opened git bash and ran git lfs init, it doesn't work:
$ git lfs init
git: 'lfs' is not a git command. See 'git --help'.
The only reason why "git lfs" would not be a git command would be because the git-lfs.exe hasn't been put in your %PATH%.
That is what the git-lfs-windows-amd64-0.5.3\install.bat is supposed to do.
set GIT_LFS_BIN_PATH="%LOCALAPPDATA%\GitLFS\bin"
IF EXIST %GIT_LFS_BIN_PATH% GOTO DIRECTORY_EXISTS
mkdir %GIT_LFS_BIN_PATH%
set "path=%PATH%;%GIT_LFS_BIN_PATH:"=%"
So:
Make sure install.bat was successfully executed
Check the content of "%LOCALAPPDATA%\GitLFS\bin"
make sure to open a new CMD Windows
Check your %PATH% environment variable
Just adding my 2c in case someone lands on this page..
The easiest (and I believe most "correct") option to install LFS on Windows is to use the windows' built-in winget package manager
winget install -e --id GitHub.GitLFS
I was getting the same error as you after simply running the downloaded installer, however the winget command fixed it for me.
PS. Even if you don't have winget - running winget will automatically install it from MS Store

Permission denied when creating symbolic links in git

there is a similar question, but the difference here is that I am working on Windows. I am running git on Windows (working in git bash tool) and I have successefully cloned my forked repository. Now I need to make symbolic link and it gives me Permission denied. I can make new dir for example in .git folder and I have also set chmod /R 777 for .git directory, so it seems I have permissions.
I tried to run:
rm -rf hooks and then ln -s ../git_hooks hooks.
You might be running into a basic incompatibility of ln on windows platforms (in this case within MINGW-MSYS). You can replace ln with a version that "does the right thing" on Windows; have a look at this:
Git Bash Shell fails to create symbolic links
I had this issue on Windows and I did a couple of steps to resolve this :
Enabled core.symlinks by modifying git config
git config --edit
Opened Git Bash as an Administrator and executed the git checkout command
This worked for me, hope it helps someone.
If you have are using Git for Windows SDK, you can install winln using the pacman package manager by running: pacman -Su winln
Then you can run: winln -s target link, it will check that you have SeCreateSymbolicLinkPrivilege, otherwise it will fail. This is equivalent to running Window's mklink.exe.
I am surprise Git for Windows, does not ship with winln vs an ln command that does a copy without telling you that it did a copy.
When installing git-bash for windows, there is an option called "Enable symbolic links". When I installed git-bash with that option I had the same issue as OP. So I installed the same setup (git-bash) again with that "Enable symbolic links" option unchecked. Then my issue was resolved.
If you are using a local web server on Windows (OpenServer, Laragon, Local), then start the server as an administrator. It worked for me

Adding Git to PATH Variable - Can't find GitHub under AppData/Local

I was following this guide here on how to add Git to my Path variable so I can use it from the command line (Not just Git Bash).
Installing Git in PATH with GitHub client for Windows
To quote an answer, Git was supposedly located here
Get the Git URL
We need to get the url of the Git \cmd directory your computer. Git is
located here:
C:\Users\\AppData\Local\GitHub\PortableGit_\bin\git.exe
I opened File Explorer and went to the directory C:\Users\AppData\Local\
Under the view tab, I have Hidden Items checked. I cannot see a GitHub folder listed. In the search bar, I appended GitHub to the end of the directory path and got the following message
Windows can't find 'C:\Users\username\AppData\Local\GitHub'. Check the spelling and try again.
I'm trying to add Git to my environment path variable, but can't find where git is located.
In Git Bash, I was able to try which git where I got /bin/git
But I'm not sure how I can find what to put in under environment variable.
Doing a random search, I actually found that the Git folder was located here
C:\ProgramFiles(x86)\Git
But what am I supposed to enter for the path variable? This is different from the answer in the other question.
Just add the path to the command. This was the path to add to the end of the windows PATH.
C:\Program Files\Git\bin\
Now we should be able to find git.exe by typing
git
It turns out Git was being sneaky!
It was supposed to be installed in AppData/Local, but was actually installed in the Program Files(x86) directory.
I added this to my Path variable after a semicolon
C:\Windows\Program Files(x86)\Git\bin\git.exe
And magically, I can run git again.
For Windows 7 using GIT 2.7.2 I used this in the path under environment variables:
;C:\Program Files\Git\bin;C:\Program Files\Git\bin\cmd. I then typed git --version from a command prompt and got:
git version 2.7.2.windows.1
Another way is found in this place https://stackoverflow.com/a/34767523/5842689
the best thing is you can test if work in cmd.
"o verify, restart cmd and type git --version in cmd"
it works for me cause the real path in my case (Win10 x64)is
C:\Program Files (x86)\Git\bin\git.exe

Resources