Git Clone: Clone succeeded, but checkout failed - windows

I was cloning my repository in Windows: https://github.com/garvit-joshi/Competitive-Programming
Cloning into 'Competitive-Programming'...
remote: Enumerating objects: 124, done.
remote: Counting objects: 100% (124/124), done.
remote: Compressing objects: 100% (113/113), done.
remote: Total 399 (delta 53), reused 35 (delta 10), pack-reused 275
Receiving objects: 100% (399/399), 130.31 KiB | 357.00 KiB/s, done.
Resolving deltas: 100% (174/174), done.
error: invalid path 'HackerRank/A: Left Rotation.cpp'
fatal: unable to checkout working tree
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry with 'git restore --source=HEAD :/'
I have tried renaming the file in GitHub and then cloning the repo but No Success.

Related

Restore all files except one folder

I've cloned this repo, but two of the files have an asterisk * in their names which is a disallowed character for Windows filenames. This means the repo clones but fails to checkout. Cloning looks like this:
> git clone https://github.com/mallowigi/iconGenerator.git
Cloning into 'iconGenerator'...
remote: Enumerating objects: 2592, done.
remote: Counting objects: 100% (2592/2592), done.
remote: Compressing objects: 100% (1545/1545), done.
remote: Total 2592 (delta 1232), reused 2383 (delta 1037), pack-reused 0R
Receiving objects: 100% (2592/2592), 14.87 MiB | 7.26 MiB/s, done.
Resolving deltas: 100% (1232/1232), done.
# hits error here
error: invalid path 'examples/files/*.pyc'
fatal: unable to checkout working tree
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry with 'git restore --source=HEAD :/'
When I try git restore --source=HEAD . I get this error:
> git restore --source=HEAD .
error: invalid path 'examples/files/*.pyc'
error: invalid path 'examples/files/*.pyo'
I could go through manually and restore all the folders except examples/files/, but my question is: Is there a way to do this with one command? Maybe something like:
> git restore --source=HEAD . --except=/examples/files/*
As per evolutionxbox's comment the solution was just to do
git checkout HEAD -- .
This de-stages the deletion of all the other files and leaves a git status of:
On branch master
Your branch is up to date with 'origin/master'.
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
deleted: examples/files/*.pyc
deleted: examples/files/*.pyo

Hyperledger Fabric - Samples - 2.2.0 platform specific fabric binary is not available to download

I followed the install process for using samples, but I get an error since the link https://github.com/hyperledger/fabric/releases/download/v2.2.0/hyperledger-fabric-msys_nt-10.0-17763-amd64-2.2.0.tar.gz doesn't exist.
I ran the command below:
curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/master/scripts/bootstrap.sh | bash -s
Clone hyperledger/fabric-samples repo
===> Cloning hyperledger/fabric-samples repo and checkout v2.2.0
Cloning into 'fabric-samples'...
remote: Enumerating objects: 19, done.
remote: Counting objects: 100% (19/19), done.
remote: Compressing objects: 100% (18/18), done.
remote: Total 6431 (delta 8), reused 2 (delta 1), pack-reused 6412R
Receiving objects: 100% (6431/6431), 3.69 MiB | 9.64 MiB/s, done.
Resolving deltas: 100% (3350/3350), done.
Updating files: 100% (501/501), done.
error: pathspec 'v2.2.0' did not match any file(s) known to git
Pull Hyperledger Fabric binaries
===> Downloading version 2.2.0 platform specific fabric binaries
===> Downloading: https://github.com/hyperledger/fabric/releases/download/v2.2.0/hyperledger-fabric-msys_nt-10.0-17763-amd64-2.2.0.tar.gz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 9 100 9 0 0 24 0 --:--:-- --:--:-- --:--:-- 24
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
==> There was an error downloading the binary file.
------> 2.2.0 platform specific fabric binary is not available to download <----
You can try this command:
curl -sSL https://raw.githubusercontent.com/hyperledger/fabric/release-2.2/scripts/bootstrap.sh | bash -s
I had this same problem and the only way I could solve it was by downloading an older version. Try the versions on this page:
https://hyperledger-fabric.readthedocs.io/en/release-1.4/install.html
If it fails to pull the images try it with a sudo.

Git doesn't connect from git bash but works in cmd.exe - 503 from proxy after CONNECT

When I try to connect from git bash I got:
$ /mingw64/bin/git fetch
fatal: unable to access 'https://example.com/repo.git/': Received HTTP code 503 from proxy after CONNECT
$ /mingw64/bin/git version
git version 2.8.1.windows.1
Works with cmd.exe:
"C:\Program Files\Git\mingw64\bin\git.exe" fetch
remote: Counting objects: 24, done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 13 (delta 5), reused 9 (delta 1)
Unpacking objects: 100% (13/13), done.
"C:\Program Files\Git\mingw64\bin\git.exe" version
git version 2.8.1.windows.1
It also works when I use git version from github for windows:
$ ~/AppData/Local/GitHub/PortableGit_25d850739bc178b2eb13c3e2a9faafea2f9143c0/cmd/git fetch
remote: Counting objects: 25, done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 13 (delta 6), reused 0 (delta 0)
Unpacking objects: 100% (13/13), done.
$ ~/AppData/Local/GitHub/PortableGit_25d850739bc178b2eb13c3e2a9faafea2f9143c0/cmd/git version
git version 2.7.4.windows.1
I've created issue on github https://github.com/git-for-windows/git/issues/732
Likely you have http_proxy environment variable set while you connect from within bash, and don't have it set or have it set to a different value while running the command from cmd. Check both environments with set command

can't access github via https after upgrade to Yosemite

I can't access GitHub via https after upgrade my Mac to Yosemite.
fatal: unable to access 'https://github.com/caskroom/homebrew-cask/': SSL: can't load CA certificate file
Actually,it's brew update,most of brew operations are via https when requesting github repo.
Using git version 2.1.2 (on Yosemite) I'm able to download the repo just fine:
git clone https://github.com/mitsuhiko/flask.git/
Cloning into 'flask'...
remote: Counting objects: 10113, done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 10113 (delta 2), reused 5 (delta 1)
Receiving objects: 100% (10113/10113), 4.66 MiB | 1.52 MiB/s, done.
Resolving deltas: 100% (6112/6112), done.
Checking connectivity... done.
You can try switching to ssh:
git clone git#github.com:mitsuhiko/flask.git
With https, you need to have your CAs (Certificate Authorities) in order (as in this question).

When cloning git repo under Windows I get "error: unable to create file <file>... (Is a directory)"

Z:\>git clone git://github.com/kennethreitz/httpbin.git
Cloning into 'httpbin'...
remote: Counting objects: 1073, done.
remote: Compressing objects: 100% (401/401), done.
remote: Total 1073 (delta 672), reused 1045 (delta 651)
Receiving objects: 100% (1073/1073), 114.42 KiB | 128 KiB/s, done.
Resolving deltas: 100% (672/672), done.
error: unable to create file httpbin/templates/... (Is a directory)
git version 1.8.0.msysgit.0, Windows Vista SP2 x64
What's wrong?
I think the trouble is this file here in you repo: https://github.com/kennethreitz/httpbin/blob/master/httpbin/templates/...
... is not a valid filename under windows
In order to get the repo, clone without checking out files (with -n flag):
git clone -n git://repo
Then you could use a sparse-checkout to get all file but ..., or you could only git checkout file you actually need.

Resources