Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong SHA1 of "greeting" #15

Open
rythos42 opened this issue Jan 16, 2019 · 3 comments
Open

Wrong SHA1 of "greeting" #15

rythos42 opened this issue Jan 16, 2019 · 3 comments

Comments

@rythos42
Copy link

rythos42 commented Jan 16, 2019

I swear this has to be me, but I've following the tutorial three times on different machines and I get a different SHA1 value for "Hello, world!" than the tutorial.

Tutorial says it should be

$ git hash-object greeting
af5626b4a114abcb82d63db7c8082c3c4756e51b

I'm getting

C:\Users\Craig\Desktop\Git-Bottom-up\repo>git hash-object greeting
5dd01c177f5d7d1be5346a5bc18a569a7410c2ef

Also weird, when I type "Hello, world!" into this SHA1 generator: https://passwordsgenerator.net/sha1-hash-generator/, it gives "943A702D06F34599AEE1F8DA8EF9F7296031D699" which is different from both our values! I didn't look into why this is.

We're on Windows 10, using git version 2.18.0.windows.1.

Thanks!

@jwiegley
Copy link
Owner

Do you have a CRLF at the end of the file? Try with just LF.

@rythos42
Copy link
Author

Thank you!

It turns out that it doesn't matter whether it's CRLF or LF -- just that there is a new line at the end, As a Windows user, I didn't know that that echo command would add a new line!

clach04 added a commit to clach04/git-from-the-bottom-up that referenced this issue Aug 24, 2024
Updated echo sample for "greeting" to be portable for both Unix/Linux and Windows.

The Microsoft Windows CMD echo treats both single and double quotes as values (not delimiters).
@clach04
Copy link

clach04 commented Aug 24, 2024

Posted #41 - slightly different approach in answer but mostly the same :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants