Git instaweb on windows? got a error - windows

Is it possible to use instaweb on windows?
I have a bare repository at D:/myrepo and I want to use instaweb to see it like
this
I have tried this command
git instaweb --httpd=webrick
But I got this error
git: 'instaweb' is not a git command. See 'git --help'.
Thanks in advance.

The instaweb command is not yet supported for Windows as of version 1.9.0. It's listed under 'Known issues' in the Windows release notes:
Known issues
• Some commands are not yet supported on Windows and excluded from the
installation; namely: git archimport, git cvsexportcommit, git
cvsimport, git cvsserver, git instaweb, git shell.

I got it working using git in MSYS2:
Install MSYS2
Install git:
pacman -S git
Install ruby (webrick is part of Ruby standard library):
pacman -S ruby
You may need to install the CGI.pm perl module using CPAN
And go:
git instaweb -d webrick

Related

'git init -b <branch name>' command in terminal is throwing an 'unknown switch' error

I am trying to add an existing project to GitHub using the command line. I am in the relevant working directory in the terminal and am trying to use the git init -b main command.
Initially, I was getting an error relating to xcode:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
I tried xcode-select --install but the software was unavailable from the update server, so I downloaded 'Command Line Tools for Xcode 12' from https://developer.apple.com/download/more/.
Now on entering git init -b main I am getting the following:
error: unknown switch `b'
usage: git init [-q | --quiet] [--bare] [--template=<template-directory>] [--shared[=<permissions>]] [<directory>]
--template <template-directory>
directory from which templates will be used
--bare create a bare repository
--shared[=<permissions>]
specify that the git repository is to be shared amongst several users
-q, --quiet be quiet
--separate-git-dir <gitdir>
separate git dir from working tree
I am running git version: 2.24.3 (Apple Git-128)
Any help much appreciated!
The -b flag is only available in version 2.28 or later, you need to upgrade your Git.
On debian-based Linux systems such as Ubuntu, do the following:
sudo add-apt-repository -y ppa:git-core/ppa
sudo apt update
sudo apt install git -y
git 2.24 doesn't have option -b/--initial-branch. It was added in git 2.28. You need to upgrade to use the option.
Or, as #matt said, create a repo and then rename the branch:
git init repo
cd repo
git branch -m master slave
prior to git v2.28
git init # ①
git symbolic-ref HEAD refs/heads/main # ②
① After git init, the branch master does not actually exist. Branches get created only when they have at least one commit.
② This updates .git/HEAD to contain ref: refs/heads/main instead of ref: refs/heads/master. Alternatively, git checkout -b main.
git v2.28+
As #phd said, the -b/--initial-branch option was added in git v2.28. git 2.28 also introduces a config option to specify your preferred default branch:
git config --global init.defaultBranch main
Learn more about the new init.defaultBranch setting in GitHub's blog post.
In case you need to install the latest git version (in Ubuntu)
sudo add-apt-repository -y ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git -y
Ref: https://gist.github.com/YuMS/6d7639480b17523f6f01490f285da509
This is happening due to the unavailability of a tool called Xcode Select, running xcode-select --install in your terminal fixes these issues with Git not working.

How to install patchutils on Windows 10

I already have Git and Git Bash installed. I find it inconvenient to create an "interdiff" between two patch files in Git Bash using only git commands. I would like to install patchutils, so that I can use the interdiff command -- and thus create interdiffs using the patch files directly, without committing code first.
How do I install patchutils such that I can use it from Git Bash? I tried npm install patchutils, but no success.
Another approach to this issue would be to use MSYS2 instead of "Git Bash".
MSYS2 has its own Git package, and it has a PatchUtils package:
https://packages.msys2.org/base/patchutils

How to install go-sql-driver on Windows

I am trying to install go-sql-driver on Windows Vista but I am having problems with GOPATH.
I installed git as suggested and added GOPATH as a new user environment in Windows with path C:/users/A/desktop/go.
I ran go get github.com/go-sql-driver/mysql in the command line but it gives me this error:
C:\>go get github.com/go-sql-driver/mysql
go: missing Git command. See http://golang.org/s/gogetcmd
package github.com/go-sql-driver/mysql: exec: "git": executable file not found in %PATH%
When I go look at http://golang.org/s/gogetcmd it merely says download git. But it is already downloaded in my machine.
I also went ahead and created a new environement variable for PATH and set its path to the directory where git was installed but that did not help either.
What am I doing wrong?
Download the Windows version of Git from http://git-scm.com/downloads.
Run the downloaded executable file, currently Git-1.8.3-preview20130601.exe, which will start a Git Setup wizard to install Git.
Check Git Setup Options
Run Git from the Windows Command Prompt
Checkout as-is, commit Unix-style line endings
Check the installation by running:
C:\>git --version
git version 1.8.3.msysgit.0
Make sure Git is in the %PATH% environment variable and ensure Git is installed. If you cannot run git --version in the command prompt, then the Git binary directory isn't listed in your %PATH%. Fix this by adding Git to the path, close the command prompt, and run git --version in a new command prompt. If you're still having issues, then you might be having other problems.
Install the GIT BASH desktop app in your Windows PC. The download link is here. Once installed, open the shell and type:
go get -u github.com/go-sql-driver/mysql
This will install driver for Golang's MySQL database package

How to update my version of git on OSX 10.8

I'm on OSX 10.8.2 and I'm running git git v1.7.4.4
I just installed git on a remote server and it's version 1.11.x. I'm I would like to be running the same version of the software but I cannot figure out how to update git on my laptop.
I attempted to follow the steps listed here, which instruct to download the git-OSX-installer, run the install (which ran smoothly) and then do:
$ sudo mkdir -p /usr/local/bin
$ sudo ln -s /usr/local/git/bin/git /usr/local/bin/git
But after this I do git --version and it's still 1.7.4.4. Did I just reinstall the same version? Or did I install a newer version somewhere else?
I've been reading similar questions and I think the issue is that OSX ships with an old version of git installed in a different location then where the git-osx-installer or mac ports will put it. But I'm not sure how to correct this. Thanks in advance for your advice.
Update:
which git returns:
/usr/bin/git
echo $PATH returns:
/opt/local/bin:/opt/local/sbin:/usr/local/rvm/gems/ruby-1.9.3-p194/bin:/usr/local/rvm/gems/ruby-1.9.3-p194#global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p194/bin:/usr/local/rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/opt/sm/bin:/opt/sm/pkg/active/bin:/opt/sm/pkg/active/sbin
Update2:
ESL ~/Downloads$ export PATH=/usr/local/bin:$PATH
ESL ~/Downloads$ which git
/usr/local/bin/git
ESL ~/Downloads$
ESL ~/Downloads$ git --version
git version 1.8.1.3
It appears I installed the newer git version in local. So should I add the export PATH=/usr/local/bin:$PATH to my .bash_profile? Is it a problem that both versions of git are installed?
I added export PATH=/usr/local/bin:$PATH to the bottom of my ~/.bash_profile and now the new version of git runs.
The best way to update any binary on a Mac OSX machine is to use the package(s) developed specifically for Mac (a .dmg or .pkg download).
In the case of git this is at: http://git-scm.com/download/mac
(clicking on this link should automatically start the download of the latest version of git for Mac).
However, in this case (at least for my 10.8.3 MacBook) this was not quite the whole story: the package installs git in /usr/local/git and then adds that path at the end of $PATH - which defeats the whole purpose IMO.
I have manually modified my .bashrc so as to have something similar to what suggested above:
export PATH=/usr/local/git/bin:$PATH
Once you do that, you should see the correct version of git being picked:
$ git --version
git version 1.8.2.2
Note that this won't work for any app that is launched interactively (eg, via the docking bar) - you'll have to run the additional script provided in the downloaded package; see the README for instructions.
Since /usr/bin shows up before /usr/local/bin in your path, the git executable in /usr/bin will be given precedence.
try this in your shell:
export PATH=/usr/local/bin:$PATH
which git
On a side note, I'd strongly recommend using homebrew for managing installations such as this on macos
I had a similar issue in Cygwin (linux environment compiled for windows). I would do
which git
and it would respond with the correct location of the updated git compiled from source, but wouldn't actually use it until I did
hash -r git
I don't claim to understand what this did or why it had to be done, but after that git --version replied with '1.8.2.rc0.22.gb3600c3' which was clearly no longer the old git shipped with Cygwin. This may not apply to OSX, but give it a shot if which git is locating the updated binary.

Git: 'rebase' is not a git command. See 'git --help'

I set up github for mac
and now I am trying to use the git command from the terminal.
If I try to run the git rebase command I get the following message
> cd /Applications/GitHub.app/Contents/Resources/git/bin
> git rebase
git: 'rebase' is not a git command. See 'git --help'.
>git --help
usage: git [--version] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
[-c name=value] [--help]
<command> [<args>]
The most commonly used git commands are:
...
rebase Forward-port local commits to the updated upstream head
....
So as you can see from the help output the option rebase is present.
What is wrong in my git?
git --version
git version 1.7.8.2
For me, I found that to fix this error message ("'rebase' is not a git command") I needed to set up Git "exec-path", either via command-line for one-shot use, or better via environment variable:
export GIT_EXEC_PATH=/PATH/TO/git/libexec/git-core
You're using the Git build that comes with GitHub for Mac. They (GitHub, that is) probably modified the binary to remove features that GitHub for Mac doesn't use.
You should really install your 'own' Git. I recommend using Homebrew: Link
This occasionally occurs to me, but only in association with changes in Xcode installation or macOS installs.
The Xcode command line tools need re-installing:
$ xcode-select --install
This is will launch the GUI for installing those tools. Once this finishes, git works as expected.

Resources