How can I install custom git commands (like git hooks) on Windows? - windows

I am trying to use the git-hooks tool on Windows. But, I cannot figure out how to install the git-hooks.sh file such that I can type git hooks --install in Git Bash.
I tried putting it in C:\Program Files (x86)\Git\git, where a lot of other git-*.sh files seem to live. But no luck.
What's the secret?

Like the git-hooks installation instructions say, you need to "Add git-hooks to your PATH environment variable so 'git hooks' can be run" (or copy git-hooks to a directory that already is in your PATH). Neither the C:\Program Files (x86)\Git\git (does that directory really exist for you, I do not see it here) nor the C:\Program Files (x86)\Git\libexec\git-core directories are in your PATH by default. Although in fact any directory which is in your PATH would work, I'd recommend to use the directory where git.exe is located, usually C:\Program Files (x86)\Git\bin. Also be sure to keep the original git-hooks file name, do not rename the file to git-hooks.sh although it is a shell script.

Related

'mvn' is not recognized as an internal or external command (tried everything, still not working)

Sorry I bother you, but this is my last option. I've read lot of an articles also from here Stackoverflow, and tried all things in those articles, but still not working. I really have a headache of this maven-enviromental-case, it is exploding my head very soon.
I have installed Maven to C:\Program Files\apache-maven-3.8.4
I have put it to the System Enviroment variables like this:
Variable Value
MAVEN_HOME C:\Program Files\apache-maven-3.8.4
Included MAVEN_HOME to System Enviroment Variables path like this: %MAVEN_HOME%\bin. Also tried to include location itself to the path like this C:\Program Files\apache-maven-3.8.4
.
Also tried to add those all in User variables. Restarted computer, tried to run CMD as Administrator, any of these working. If I echo %MAVEN_HOME% I get C:\Program Files\apache-maven-3.8.4. In IntelliJ IDEA I see the MAVEN_HOME variable in terminal variables.
Added it to System like this:
And to the PATH like this:
Echoing %PATH% in CMD:
Maven install directory:
Ah something I expected. You have downloaded the github archive but not installation archive https://maven.apache.org/download.cgi (-bin.zip file!). Remove the whole directory first (delete it!)...download the zip archive from the download side and unpack it into the same location...

How do I add a file to a directory in terminal?

I am trying to add files to a directory that I created, and I attempted to use
cvs add filename
but that did not work, as I got the error message:
-bash: cvs: command not found
How do I fix this and be able to add files to a directory?
It's either cvs has not been installed or not found in the environment path variable e.g. $PATH. If you're sure that you have installed cvs successfully, try to execute the cvs command by using its absolute path.

How to remove gcloud fully?

I'm new on mac. I just remove gcloud folders. And now when I open my command line window I always see next:
-bash: /Users/myuser/gcloud/google-cloud-sdk/completion.bash.inc: No such file or directory
-bash: /Users/myuser/google-cloud-sdk/path.bash.inc: No such file or directory
-bash: /Users/myuser/google-cloud-sdk/completion.bash.inc: No such file or directory
I know that made mistake removing not with gcloud command. But we have whad we have. So the main question is how to not get current logs when opening command line window on mac?
The Cloud SDK makes only the following changes to the filesystem on installation:
Adds and populates the Cloud SDK root directory, where you directed the installer.
Configuration goes in the ~/.config/gcloud directory (by default).
Modifies the RC files that you specified on installation (in response to the questions Modify profile to update your $PATH and enable shell command
completion? (Y/n)? and Enter a path to an rc file to update, or leave blank to use [/Users/$USER/.bash_profile]:.
These paths are slightly different on different platforms, but the three types of files (installation files, per-user config, and .rc files) are the same.

How to restore version control in XCode?

I have just recently backed-up my XCode C++ project on my pendrive, using
rsync -avu
Since then, the version control for my project is grayed-out on every files, I can modify the files and not see the "M" nor the "A" sign. The only files still having version-control working "shared" files for which it works correctly. (Those shared files belong to a different project called "Shared").
I have tried git commit -m, git add . and even git init where the files were. Nothing worked.
Can you please help restoring version control for my project?
UPDATE:
Answers for the questions in commens (and answers):
my git repository is on my local hard drive.
I went to the Organiser-repository pane in XCode and I see my recent git commit -m "sth" as "sth" az a commit. I have a single branch: master.
Im not sure what command would be good to test git, as my commits work (theoretically).
I have a folder named .git in the project folder.
git log is working, showing the same as XCode Organiser-repository pane.
I think the XCode just can't synchronise with the git for some reason, and I don't know how to correct that.
First off, this is not an answer that will fix your problem, I just try to provide some help that might get you closer to a diagnosis.
Git stores its files in a folder named .git. Check if this folder is present in your project. If it's not then your Git repository is gone.
Next, try some basic command such as git log. For this to work, you must first cd to your project folder (or a subfolder thereof), because whenever you run a Git command it will look for the .git folder in the cwd or a parent folder. If git log does not work then your Git repository is broken in some way. Someone else will have to step in to further diagnose the problem, as I am no expert on this subject.
Finally, you should also check whether your rsync command has really sync'ed your project's .git folder with the backup's .git folder. Use this command:
diff -rq /path/to/project/.git /path/to/backup/.git
If there is no difference (as I would expect if rsync has worked correctly) then the problem with your Git repository is both in your project and in your backup. If there are differences then it might be worthwile to try your next steps on a copy of the backup (it should be fine to make the copy in the Finder).
Good luck.

Apply mulitple patches from a directory using msysgit

When I run the following command to apply multiple patches located in /c/tmp/patches msysgit hangs:
git.exe am --3way --signoff --directory=/c/tmp/patches/
I am using version 1.7.8-preview20111206.
Am I doing something wrong or is this a known issue in msysgit?
I believe the --directory switch is for specifying the target directory to apply the patch relative to and is not for telling it a directory containing patch files. According to the am documentation it passes the --directory option to the apply command (see also apply --directory documentation).
On Windows 10 git apply --3way ./.patches/*.patch runs fine in Git Bash (applies multiple patch files).
However that does not in powershell, CMD or Git CMD - I get error: can't open patch './.patches/*.patch': No such file or directory even though dir ./.patches/*.patch correctly lists the files. Not sure why (would like to know).

Resources