git-for-windows/git-sdk-64

sdk cd|init|build git does not work

Kojoley opened this issue · 10 comments

I have just downloaded git sdk and after the terminal opened

FOO@BAR MINGW64 / (master)
$ sdk cd git
Could not change directory to 'git'

FOO@BAR MINGW64 / (master)
$ sdk init git

FOO@BAR MINGW64 / (master)
$ sdk build git

FOO@BAR MINGW64 / (master)
$ sdk cd git
Could not change directory to 'git'

It looks like git in git sdk is malfunction.

$ sdk cd git

Are you typing the initial 'sdk' command ?

I don't believe you need to type the sdk for regular bask commands. The sdk command, IIUC, is a careful collection of scripts that have a nice top level interface, but isn't necessary for regular bash commands.

Yes, I type sdk. It is what I want to do, and what is written in sdk help.

$ sdk help
The 'sdk' shell function helps you to get up and running
with the Git for Windows SDK. The available subcommands are:

create-desktop-icon: install a desktop icon that starts the Git for
    Windows SDK Bash.

cd <project>: initialize/update a worktree and cd into it. Known projects
    are: git, git-extra, build-extra, MINGW-packages, MSYS2-packages.

init <project>: initialize and/or update a worktree. Known projects
    are the same as for the 'cd' command.

build <project>: builds one of the following: git, git-and-installer.

Ok, thanks for clarifying. I hadn't personally tried using the sdk commands explicitly.

I've just tried it (sdk cd git) and it did not do what I expected!

phili@Philip-Win10 MINGW64 / (master)
$ sdk cd git
remote: Enumerating objects: 809, done.
remote: Counting objects: 100% (809/809), done.
remote: Total 1305 (delta 809), reused 809 (delta 809), pack-reused 496
Receiving objects: 100% (1305/1305), 329.73 KiB | 1.10 MiB/s, done.
Resolving deltas: 100% (815/815), completed with 45 local objects.
From https://github.com/git-for-windows/git
 * branch                  master     -> FETCH_HEAD
   79ff0c6229..b85dc5cd7c  master     -> origin/master
Removing t/helper/test-helper.c
Removing replace_object.c
Removing contrib/examples/git-whatchanged.sh
Removing contrib/examples/git-verify-tag.sh
Removing contrib/examples/git-tag.sh
Removing contrib/examples/git-svnimport.txt
Removing contrib/examples/git-svnimport.perl
Removing contrib/examples/git-revert.sh
Removing contrib/examples/git-resolve.sh
Removing contrib/examples/git-reset.sh
Removing contrib/examples/git-rerere.perl
Removing contrib/examples/git-repack.sh
Removing contrib/examples/git-remote.perl
Removing contrib/examples/git-pull.sh
Removing contrib/examples/git-notes.sh
Removing contrib/examples/git-merge.sh
Removing contrib/examples/git-merge-ours.sh
Removing contrib/examples/git-ls-remote.sh
Removing contrib/examples/git-log.sh
Removing contrib/examples/git-gc.sh
Removing contrib/examples/git-fetch.sh
Removing contrib/examples/git-difftool.perl
Removing contrib/examples/git-commit.sh
Removing contrib/examples/git-clone.sh
Removing contrib/examples/git-clean.sh
Removing contrib/examples/git-checkout.sh
Removing contrib/examples/git-am.sh
Removing contrib/examples/builtin-fetch--tool.c
Removing contrib/emacs/Makefile
Removing contrib/emacs/.gitignore
Removing contrib/convert-grafts-to-replace-refs.sh
Removing builtin/rebase--helper.c
Auto-merging Documentation/config.txt
hint: Waiting for your editor to close the file...

So, 1. you will see (I saw) a wait while the sdk contacts origin and downloads the latest updates and 2. if you had some local changes (which I had - a temporary commit on master - I should have started a fresh branch but hadn't) it will attempt a merge of your work with upstream, which may not be what you want.
However, if there is nothing to do and no upstream changes, I'm guessing that the sdk gives no response (as do most git/unix commands with no result).

May have a delve into the sdk command itself! Updating the docs to clarify what you see, and should expect, would be a great start!

dscho commented

@Kojoley I suspect that you installed the Git for Windows SDK in some way that fails to prefer Git for Windows' version of mingw-w64-openssl over MSYS2's. How did you install the SDK?

I downloaded and installed it via exe from https://gitforwindows.org/ which redirected me to https://github.com/git-for-windows/build-extra/releases/tag/git-sdk-1.0.7

dscho commented

@Kojoley could you call set -x and try again, so that we can see what specific commands the sdk function is trying to run?

Also, do you have Comodo's anti-malware solution running, or some other anti-malware? Sometimes, these get a little overzealous with the Bash we use, and claim that it is malicious. That would be consistent with the symptoms.

could you call set -x and try again, so that we can see what specific commands the sdk function is trying to run?

Console log
Welcome to the Git for Windows SDK!

The common tasks are automated via the `sdk` function;
See `sdk help` for details.

FOO@BAR MINGW64 / (master)
$ set -x
++ __git_ps1
++ local exit=0
++ local pcmode=no
++ local detached=no
++ local 'ps1pc_start=\u@\h:\w '
++ local 'ps1pc_end=\$ '
++ local 'printf_format= (%s)'
++ case "$#" in
++ printf_format=' (%s)'
++ local ps1_expanded=yes
++ '[' -z '' ']'
++ '[' -z '4.4.19(2)-release' ']'
++ shopt -q promptvars
++ local repo_info rev_parse_exit_code
+++ git rev-parse --git-dir --is-inside-git-dir --is-bare-repository --is-inside-work-tree --short HEAD
++ repo_info='.git
false
false
true
9417e44d'
++ rev_parse_exit_code=0
++ '[' -z '.git
false
false
true
9417e44d' ']'
++ local short_sha=
++ '[' 0 = 0 ']'
++ short_sha=9417e44d
++ repo_info='.git
false
false
true'
++ local inside_worktree=true
++ repo_info='.git
false
false'
++ local bare_repo=false
++ repo_info='.git
false'
++ local inside_gitdir=false
++ local g=.git
++ '[' true = true ']'
++ '[' -n '' ']'
++ local r=
++ local b=
++ local step=
++ local total=
++ '[' -d .git/rebase-merge ']'
++ '[' -d .git/rebase-apply ']'
++ '[' -f .git/MERGE_HEAD ']'
++ '[' -f .git/CHERRY_PICK_HEAD ']'
++ '[' -f .git/REVERT_HEAD ']'
++ '[' -f .git/BISECT_LOG ']'
++ '[' -n '' ']'
++ '[' -h .git/HEAD ']'
++ local head=
++ __git_eread .git/HEAD head
++ test -r .git/HEAD
++ IFS='
'
++ read head
++ b=refs/heads/master
++ '[' 'ref: refs/heads/master' = refs/heads/master ']'
++ '[' -n '' ']'
++ local w=
++ local i=
++ local s=
++ local u=
++ local c=
++ local p=
++ '[' true = false ']'
++ '[' true = true ']'
++ '[' -n '' ']'
++ '[' -n '' ']'
++ '[' -n '' ']'
++ '[' -n '' ']'
++ local 'z= '
++ '[' no = yes ']'
++ b=master
++ '[' no = yes ']'
++ local f=
++ local gitstring=master
++ '[' no = yes ']'
++ printf -- ' (%s)' master
++ return 0

FOO@BAR MINGW64 / (master)
$ sdk cd git
+ sdk cd git
+ case "$1" in
+ sdk init git
+ case "$1" in
+ sdk init-lazy git
+ case "$1" in
+ case "$2" in
+ src_dir=/usr/src/git
+ src_cdup_dir=/usr/src/git
+ test -d /usr/src/git/.git
+ return
+ git -C /usr/src/git pull origin master
+ sdk die 'Could not change directory to '\''git'\'''
+ case "$1" in
+ shift
+ echo 'Could not change directory to '\''git'\'''
Could not change directory to 'git'
+ return 1
++ __git_ps1
++ local exit=1
++ local pcmode=no
++ local detached=no
++ local 'ps1pc_start=\u@\h:\w '
++ local 'ps1pc_end=\$ '
++ local 'printf_format= (%s)'
++ case "$#" in
++ printf_format=' (%s)'
++ local ps1_expanded=yes
++ '[' -z '' ']'
++ '[' -z '4.4.19(2)-release' ']'
++ shopt -q promptvars
++ local repo_info rev_parse_exit_code
+++ git rev-parse --git-dir --is-inside-git-dir --is-bare-repository --is-inside-work-tree --short HEAD
++ repo_info='.git
false
false
true
9417e44d'
++ rev_parse_exit_code=0
++ '[' -z '.git
false
false
true
9417e44d' ']'
++ local short_sha=
++ '[' 0 = 0 ']'
++ short_sha=9417e44d
++ repo_info='.git
false
false
true'
++ local inside_worktree=true
++ repo_info='.git
false
false'
++ local bare_repo=false
++ repo_info='.git
false'
++ local inside_gitdir=false
++ local g=.git
++ '[' true = true ']'
++ '[' -n '' ']'
++ local r=
++ local b=
++ local step=
++ local total=
++ '[' -d .git/rebase-merge ']'
++ '[' -d .git/rebase-apply ']'
++ '[' -f .git/MERGE_HEAD ']'
++ '[' -f .git/CHERRY_PICK_HEAD ']'
++ '[' -f .git/REVERT_HEAD ']'
++ '[' -f .git/BISECT_LOG ']'
++ '[' -n '' ']'
++ '[' -h .git/HEAD ']'
++ local head=
++ __git_eread .git/HEAD head
++ test -r .git/HEAD
++ IFS='
'
++ read head
++ b=refs/heads/master
++ '[' 'ref: refs/heads/master' = refs/heads/master ']'
++ '[' -n '' ']'
++ local w=
++ local i=
++ local s=
++ local u=
++ local c=
++ local p=
++ '[' true = false ']'
++ '[' true = true ']'
++ '[' -n '' ']'
++ '[' -n '' ']'
++ '[' -n '' ']'
++ '[' -n '' ']'
++ local 'z= '
++ '[' no = yes ']'
++ b=master
++ '[' no = yes ']'
++ local f=
++ local gitstring=master
++ '[' no = yes ']'
++ printf -- ' (%s)' master
++ return 1

FOO@BAR MINGW64 / (master)
$ sdk init git
+ sdk init git
+ case "$1" in
+ sdk init-lazy git
+ case "$1" in
+ case "$2" in
+ src_dir=/usr/src/git
+ src_cdup_dir=/usr/src/git
+ test -d /usr/src/git/.git
+ return
+ git -C /usr/src/git pull origin master
++ __git_ps1
++ local exit=1
++ local pcmode=no
++ local detached=no
++ local 'ps1pc_start=\u@\h:\w '
++ local 'ps1pc_end=\$ '
++ local 'printf_format= (%s)'
++ case "$#" in
++ printf_format=' (%s)'
++ local ps1_expanded=yes
++ '[' -z '' ']'
++ '[' -z '4.4.19(2)-release' ']'
++ shopt -q promptvars
++ local repo_info rev_parse_exit_code
+++ git rev-parse --git-dir --is-inside-git-dir --is-bare-repository --is-inside-work-tree --short HEAD
++ repo_info='.git
false
false
true
9417e44d'
++ rev_parse_exit_code=0
++ '[' -z '.git
false
false
true
9417e44d' ']'
++ local short_sha=
++ '[' 0 = 0 ']'
++ short_sha=9417e44d
++ repo_info='.git
false
false
true'
++ local inside_worktree=true
++ repo_info='.git
false
false'
++ local bare_repo=false
++ repo_info='.git
false'
++ local inside_gitdir=false
++ local g=.git
++ '[' true = true ']'
++ '[' -n '' ']'
++ local r=
++ local b=
++ local step=
++ local total=
++ '[' -d .git/rebase-merge ']'
++ '[' -d .git/rebase-apply ']'
++ '[' -f .git/MERGE_HEAD ']'
++ '[' -f .git/CHERRY_PICK_HEAD ']'
++ '[' -f .git/REVERT_HEAD ']'
++ '[' -f .git/BISECT_LOG ']'
++ '[' -n '' ']'
++ '[' -h .git/HEAD ']'
++ local head=
++ __git_eread .git/HEAD head
++ test -r .git/HEAD
++ IFS='
'
++ read head
++ b=refs/heads/master
++ '[' 'ref: refs/heads/master' = refs/heads/master ']'
++ '[' -n '' ']'
++ local w=
++ local i=
++ local s=
++ local u=
++ local c=
++ local p=
++ '[' true = false ']'
++ '[' true = true ']'
++ '[' -n '' ']'
++ '[' -n '' ']'
++ '[' -n '' ']'
++ '[' -n '' ']'
++ local 'z= '
++ '[' no = yes ']'
++ b=master
++ '[' no = yes ']'
++ local f=
++ local gitstring=master
++ '[' no = yes ']'
++ printf -- ' (%s)' master
++ return 1

FOO@BAR MINGW64 / (master)
$ sdk build git
+ sdk build git
+ case "$1" in
+ case "$2" in
+ sdk init git
+ case "$1" in
+ sdk init-lazy git
+ case "$1" in
+ case "$2" in
+ src_dir=/usr/src/git
+ src_cdup_dir=/usr/src/git
+ test -d /usr/src/git/.git
+ return
+ git -C /usr/src/git pull origin master
++ __git_ps1
++ local exit=1
++ local pcmode=no
++ local detached=no
++ local 'ps1pc_start=\u@\h:\w '
++ local 'ps1pc_end=\$ '
++ local 'printf_format= (%s)'
++ case "$#" in
++ printf_format=' (%s)'
++ local ps1_expanded=yes
++ '[' -z '' ']'
++ '[' -z '4.4.19(2)-release' ']'
++ shopt -q promptvars
++ local repo_info rev_parse_exit_code
+++ git rev-parse --git-dir --is-inside-git-dir --is-bare-repository --is-inside-work-tree --short HEAD
++ repo_info='.git
false
false
true
9417e44d'
++ rev_parse_exit_code=0
++ '[' -z '.git
false
false
true
9417e44d' ']'
++ local short_sha=
++ '[' 0 = 0 ']'
++ short_sha=9417e44d
++ repo_info='.git
false
false
true'
++ local inside_worktree=true
++ repo_info='.git
false
false'
++ local bare_repo=false
++ repo_info='.git
false'
++ local inside_gitdir=false
++ local g=.git
++ '[' true = true ']'
++ '[' -n '' ']'
++ local r=
++ local b=
++ local step=
++ local total=
++ '[' -d .git/rebase-merge ']'
++ '[' -d .git/rebase-apply ']'
++ '[' -f .git/MERGE_HEAD ']'
++ '[' -f .git/CHERRY_PICK_HEAD ']'
++ '[' -f .git/REVERT_HEAD ']'
++ '[' -f .git/BISECT_LOG ']'
++ '[' -n '' ']'
++ '[' -h .git/HEAD ']'
++ local head=
++ __git_eread .git/HEAD head
++ test -r .git/HEAD
++ IFS='
'
++ read head
++ b=refs/heads/master
++ '[' 'ref: refs/heads/master' = refs/heads/master ']'
++ '[' -n '' ']'
++ local w=
++ local i=
++ local s=
++ local u=
++ local c=
++ local p=
++ '[' true = false ']'
++ '[' true = true ']'
++ '[' -n '' ']'
++ '[' -n '' ']'
++ '[' -n '' ']'
++ '[' -n '' ']'
++ local 'z= '
++ '[' no = yes ']'
++ b=master
++ '[' no = yes ']'
++ local f=
++ local gitstring=master
++ '[' no = yes ']'
++ printf -- ' (%s)' master
++ return 1

Also, do you have Comodo's anti-malware solution running, or some other anti-malware? Sometimes, these get a little overzealous with the Bash we use, and claim that it is malicious. That would be consistent with the symptoms.

I do not have any antivirus software, even Windows Defender is turned off.

dscho commented
+ test -d /usr/src/git/.git
+ return

This corresponds to this line in the sdk function and suggests that /usr/src/git/.git exists and is a directory.

+ git -C /usr/src/git pull origin master
+ sdk die 'Could not change directory to '\''git'\'''

This, however, suggests that /usr/src/git does not exist.

Which contradicts the earlier outcome. What is going on in your system?

What is going on in your system?

My system is fine. The folder exists, I can see it with everything, like windows explorer or

$ ls /usr/src/git/.git
+ ls -F --color=auto --show-control-chars /usr/src/git/.git
config  description  FETCH_HEAD  HEAD  hooks/  info/  objects/  refs/

Maybe sdk have problems with non-default locations? I installed it into G:\git-sdk-64\.

In any case I do not want to waste my time for this.