UKDataServiceOpen / Crime_Data_in_R

This is a repository collecting all the materials, code, resources and extras for a UKDS workshop on Crime Data in R.
22 stars 7 forks source link

clone success, but checkout failed. #2

Open fdq09eca opened 1 year ago

fdq09eca commented 1 year ago

see error below

> git clone https://github.com/UKDataServiceOpen/Crime_Data_in_R.git
Cloning into 'Crime_Data_in_R'...
remote: Enumerating objects: 978, done.
remote: Counting objects: 100% (199/199), done.
remote: Compressing objects: 100% (152/152), done.
remote: Total 978 (delta 101), reused 114 (delta 44), pack-reused 779
Receiving objects: 100% (978/978), 213.83 MiB | 7.05 MiB/s, done.
Resolving deltas: 100% (335/335), done.
error: invalid path 'March_2023/Webinar /Live Code Demo Slide Deck.pptx'
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 :/'

file/folder can be retrieved by git restore --source=HEAD :/

> git restore --source=HEAD :/
error: invalid path 'March_2023/Webinar /Live Code Demo Slide Deck.pptx'
error: invalid path 'March_2023/Webinar /Mapping Crime Data in R Day 1 (03_2023) copy.pptx'

> ls 

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----          3/9/2023   9:23 PM                assets
d-----          3/9/2023   9:23 PM                Dec_2021
d-----          3/9/2023   9:23 PM                Feb_2021
d-----          3/9/2023   9:23 PM                June_2022
d-----          3/9/2023   9:23 PM                March_2023
-a----          3/9/2023   9:23 PM            218 Crime_Data_in_R.Rproj
-a----          3/9/2023   9:23 PM            119 environment.yml
-a----          3/9/2023   9:23 PM            135 install.r
-a----          3/9/2023   9:23 PM           1475 README.md
-a----          3/9/2023   9:23 PM             19 runtime.txt

I am on a window machine, I believe the error is because the spaces of the folder/file names

'March_2023/Webinar /Live Code Demo Slide Deck.pptx'
'March_2023/Webinar /Mapping Crime Data in R Day 1 (03_2023) copy.pptx'

@NadiaK98 would you please clean the names? Thank you

NadiaK98 commented 1 year ago

Hi, thank you for sharing this error. I believe the issue was due to long file name when working in Git for Windows. I've gone ahead and cleaned the names so please leave another comment if this issue persists.

For future reference, you can circumvent this by running Git Bash as administrator (right-clicking the app shortcut will show the option to Run as Administrator ) and then setting core.longpaths to true as seen here

git config --system core.longpaths true.

Thank You

hignell commented 6 months ago

Hi @NadiaK98, an error has also occurred when I tried to set up a new project using Git Version Control. the error message was:

error: invalid path 'Feb_2024/Webinar /.DS_Store'
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 :/'

UPDATE: I have now downloaded a zip of the git directly from https://github.com/UKDataServiceOpen/Crime_Data_in_R and I can open the R project within that. Is that a sufficient workaround for the workshop?

NadiaK98 commented 6 months ago

Hi, sorry for the delayed response! Thank you for pointing out that error with the .DS_store files. These were accidentally committed to the repository but have now been removed and cloning should work. Downloading the content as a zip file also works, you will still be able to follow along with the content but make sure to have downloaded the most recent repo since changes have been made!

hignell commented 6 months ago

Thank you @NadiaK98. I have just attempted the clone the repository again and I got the following error:

error: invalid path 'Feb_2024/Webinar /MCDR_Menti_Results_Session1_2024.pdf'
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 will download the zip file again before the session tomorrow.