How do I use git-new-workdir on windows? - windows

I have a repo that has two branches, which i would like to work on simultaneously.
After some reading I found git has a script git-new-workdir.
Im trying run use the script from the git for windows bash but get the following error.
$ git-new-workdir
sh: git-new-workdir: command not found
How do I use this script on windows?

Due to some of the commands in the git-new-workdir functions not existing on windows, the script won't work.
I have found this windows port of the script. Works great for me.
https://github.com/joero74/git-new-workdir

Git 2.5 (Q2 2015) will replace contrib/workdir/git-new-workdir with an official native Git command which works on any OS (including Windows).
The release notes mentions:
does not rely on symbolic links and make sharing of objects and refs safer by making the borrowee and borrowers aware of each other.
That is because the multiple working trees are "linked", or actually recorded in the main repo new $GIT_DIR/worktrees folder.
See "Multiple working directories with Git?" for more.

On my installation, the script file is located in /usr/share/git/contrib/workdir/git-new-workdir.
Perhaps if it's not installed in that version of git, you can just download its raw form and run it with bash /path/to/git-new-workdir. At your preference you can also install it in /usr/local/bin changing permissions when necessary.

Related

Git Bash -Segmentation Fault Problem (Windows)

Indeed I have same issue which is mentioned here "Why does bash (from git installation) give me segmentation fault suddenly?
"
My git was working properly. But I need to regenerate keygen value and I got segmentation fault. I remoted git and installed the latest version of git (2.19.0-64-bit). I tried with git-bash from search, bash.exe from bin folder , git.exe from bin folder , git-bash.exe under Git Folder and git-cmd.exe under Git folder. The results are same.
After I read the link I shared above , I checked the windows updates as well. But there is no update.
Is there any idea ? Thanks in advance
2.9 is not the latest, one: 2.19 is.
Try (for testing) and uncompress the latest Git for Windows portable archive PortableGit-2.19.0-64-bit.7z.exe anywhere you want.
Then setup a simplified path in a CMD session.
set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
set GIT_HOME=C:\Path\to\Git
set PATH=%GIT_HOME%;%GIT_HOME%\bin;%GIT_HOME%\usr\bin;%GIT_HOME%\mingw64\bin;%PATH%
(Add any other path you would need)
Try then to regenerate your SSH key.
Also, make sure this is not related to an AV (Anti-Virus) as in issue 1832 or issue 1291.
My company also uses TrendMicro.
Can confirm that making an exception for /Git/usr/bin/bash.exe works as well.
For me it was C:\Program Files\Git\usr\bin, but adding it to the list of trusted programs did indeed fix the issue
I faced the same problem yesterday. Using git-bash, all my commands (i.e. mvn, javac, git pull) were giving error "Segmentation fault". This was because an update of my machine anti-virus which blocks proper access to my local login profile (sambit-swain#TERMINAL) After un-installing it, everything went back to normal.
So, the problem is not with GIT BASH or any other configuration. I should have checked the access levels (including SSH keys) to programs.

Does VSCode come with git itself?

The documentation says plain as day that VSCode does not come with git, that it leverages your machine's git installation and you must install it.
HOWEVER, it worked just fine for me. I only had github desktop and I am absolutely positively sure that I did not have git for windows installed and github desktop did not place itself in my PATH. (Technically I did have git on Bash on WSL but I know vscode isn't/can't access that). And yet it worked just fine for the longest time.
So, my question is, did vscode come with its own git executable? I ask because ever since I set up 2 factor auth on my github account I've been having to manually log in each time I push, it doesn't use my SSH keys stored in username/.ssh like git shell does.
Github Desktop installs git for you, typically located "C:\Program Files\Git", which is what VSCode, in your case, is most likely using.
If you refer to the answer from this post:
VSCode Terminal + Git Bash "command not found" for any command
it shows the settings (settings.json) that you need to add to allow for git bash and login to be used.
Hopefully this helps!

How to apply Magento security patches in xampp for windows

That must not be so difficult to do, I installed Magento CE 1.9 on xampp for windows. it works well.
I need to apply security patches that come only as .sh files, no other format is available.
I have the file, how can I apply it gives that I don't find a way to execute the .sh files under this environment?
thanks all
1) My windows has sh.exe available and can run .sh files - just type it into the command line, git bash works fine too.
UPDATE: my sh.exe was likely installed along with git. It is relatively easy to install though.
2) On windows machines you may need to edit the PATCH-... file. Find the CURRENT_DIR=``$PWD_BIN``/ line. Since you will be running it from the magento root directory anyway this can be left blank. Go ahead and remove everything after the equals sign. It should now read CURRENT_DIR=. See here for an explanation.
3)Now just move the file into your magento root directory and run it.
Try the Below Link Using Git-bash in Windows :
Magento Patch File Installation in Windows
Cygwin will help you to run the sh file.
cygwin
How to use Cygwin
Better you use git bash instead. Just go at the Magento Root and run {sh Patch_file.sh}.

svn version control authentication fails when run from emacs

I'm using on my desktop native windows emacs 24.2 configured to use cygwin bash.
When I run SVN from cygwin bash everything works fine. It remembers my authorization credentials and connects to a repository. But when I try to run any version-control command from within emacs I always get the following message:
svn: E170001: Unable to connect to a repository at URL
'https://address.to.repo' svn: E170001: OPTIONS of
'https://address.to.repo': authorization failed: Could not
authenticate to server: rejected Basic challenge
I tried also connect with PSVN interface which also ends up with the same error message. It is somehow strange that it does not work the same way from cygwin terminal and emacs. Any help on this would be appreciated.
Solved now. The problem was that Emacs NT cygwin integrated was still using windows HOME path instead of using cygwinized HOME directory.
I think the full answer should be something like this:
SVN depends on the HOME path to find its per user settings (as most unix programs).
In cygwin that varible has something like "/home/pablo".
"/home/pablo" is really translated "drive:\cygwin_dir\home\pablo"
Emacs-nt grabs its HOME from the windows environment so it is a different HOME than cygwin's
emac's vc-svn uses the wrong path to look for its settings.
So there are two solutions (maybe more):
Make emacs-nt use the cygwin's HOME (so thats what cygwinization means!! :O), you need setup-cygwin for this, but specially you need one script it depends on cygwin-mount. So emacs-nt can understand cygwin's path "style".
(not recomended) The other way around, which is what I did, make cygwin use the window's HOME through a soft cygwin link. ln -s /cygdrive/c/Users/pablo/Roaming/ /home/pablo
Make a soft link so the cygwin's subversion dir points to the windows one ln -s /cygdrive/c/users/pablo/AppData/Roaming/.subversion /home/pablo/.subversion
The second solution WILL lead to cygwin's ".bashrc" not executed. So environment variables and aliases defined there won't be define. I still think that it can be done, but I don't have the proper cygwin knowledge needed to tweak that solution. So right now I'm using the solution number 3.

msysgit error with hooks: "git error: cannot spawn .git/hooks/post-commit: No such file or directory"

I'm having trouble getting post-recieve and post-commit hooks to work correctly with msysgit (Windows 7 Pro/32 and Ultimate/64). For post-commit hook I get the above error if I commit from either git-bash or the console, but it works fine if I commit through git-gui. For a post-recieve hook, all three give the same error.
I'm thinking this is some sort of permission or path error, but don't really have any clue where to start here.
Add the SHEBANG to the first line of hook, like so:
#!/bin/sh
echo "executing post-commit"
exit 0
This had me stumped for a while as well and I saw that adding the shebang fixed it. In SVN world, while in *nix we have a "pre-commit" script and in Windows we had "pre-commit.bat" and SVN automatically picked up the bat file in Windows. Git doesn't seem to pick up a pre-commit.bat ( or any hook ) and adding the shebang to the hook file worked.
I'm using SourceTree and git LFS and had a similar issue: cannot spawn .git/hooks/pre-push.
The fix was to delete the pre-push file (opening it revealed it was badly corrupted) and restart SourceTree at which point it regenerates the pre-push file and everything is back to normal.
If you have the SHEBANG and it still fails, make sure you have <path_to_git>\bin set in your path environment variable.
You'll probably also have <path_to_git>\cmd if you installed it to work from the command-line.
This is an old question, but I've been fighting with this exact problem and this SO question popped up, so I thought it worth the effort to record what worked for me.
In short: I needed to run Apache as a regular user instead of Local System. This was on a legacy test VM I was playing with, so it was only running Windows XP, but it appears that at least on that platform (and possibly others), msysgit just doesn't work properly when running under the Local System account (presumably the root filesystem isn't mapped properly). As a result, no shebang line will work as git-http-backend simply can't execute any msysgit binaries (even with absolute Windows paths).
Switching Apache to run as a regular user account fixed this problem completely. Obviously you need to ensure that the user Apache is running as has permissions to read/write the git repositories, but beyond that, just make sure your shebang line is #!/bin/sh and everything should be copacetic.
Lastly, yeah, this is a big hammer. Ideally you'd be able to use something like suexec on Windows, but a quick googling doesn't indicate an obvious path forward, there. Of course, if anyone has any ideas, I'd be interested.
For now, this works for me, but it doesn't seem ideal.
Got this in a repo using LFS, got rid of it with git lfs update --force
If someone, like me run into a similar problem with accessing git repositories through apache, you should set the PATH in Apache config, like:
SetEnv PATH "c:/Program Files (x86)/Git/bin;"
Using tortoisegit and LFS, for me just had to remove the files inside of the .git/hooks folder.
If you are using Android studio, you can remove this error by un-check the checkbox "Run Git hooks":
For me, removing a comment line on front of the shebang line fixed the error. Oddly, the script ran fine from the shell, just errored out when run as a hook.

Resources