-1

I'm trying to test a pull request. I performed a fresh clone:

$ git clone https://github.com/weidai11/cryptopp.git cryptopp-ds
$ cd cryptopp-ds

I then issued the following to pull the pr:

$ git checkout -b droark-master master
$ git pull https://github.com/droark/cryptopp.git master

It results in a totally irrelevant error that has absolutely no basis to stop this workflow:

From https://github.com/droark/cryptopp
 * branch            master     -> FETCH_HEAD

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'cryptopp@qotom.(none)')

git pull --force https://github.com/droark/cryptopp.git master produces the same error.

I'm not interested in these useless, irrelevant policy decisions that the authors are Git are trying to force on me. There is no email address associated with this test account. I simply want the files so I can test the changes.

How, exactly, do I pull the request so I can test the changes?

jww
  • 97,681
  • 90
  • 411
  • 885
  • 3
    It's not irrelevant. You're trying to merge a branch, therefore you're creating a commit. A commit needs an author. – Zeta Feb 28 '16 at 13:48
  • Thanks Zeta. How do I obtain the files without creating a commit? I'm not trying to commit anything. All I want to do is obtain the files so I can test the changes. – jww Feb 28 '16 at 14:04
  • If you just want to obtain the files, why don't you simply clone them into another directory? – Zeta Feb 28 '16 at 14:32
  • *"If you just want to obtain the files, why don't you simply clone them into another directory?"* - I'm following the instructions provided with the pr. If there are better ways to do it, then please share them. – jww Feb 28 '16 at 14:34
  • Git has interesting command names, `pull` means (essentially) to send a commit request to the repo. – zaph Feb 28 '16 at 15:32

2 Answers2

2

You can't perform git pull because you didn't set up your Git identity.

git pull is shortcut for git fetch && git merge.

git pull docs:

More precisely, git pull runs git fetch with the given parameters and calls git merge to merge the retrieved branch heads into the current branch. With --rebase, it runs git rebase instead of git merge.

When Git perform merge command it create commit. So this is impossible without credentials.

Anton Dozortsev
  • 4,782
  • 5
  • 34
  • 69
  • 1
    Thanks Anton. *"...because you didn't set up your Git identity"* - there is no Git identity. This is simply a test account, and it has no account information and other attributes, like an email address. – jww Feb 28 '16 at 13:55
  • @jww Even if it test account it require email address – Anton Dozortsev Feb 28 '16 at 13:57
  • Thanks again Anton. I guess the question becomes, how do I obtain the files without a pull? All I want to do is obtain the files so I can test the changes. – jww Feb 28 '16 at 14:08
2

If the local and remote branch have diverged, git pull would perform a merge and commit it. Every commit needs an author, that's obviously not the stupid policy you're referring to.

According to the docs, git pull has a parameter --no-commit, so I was hoping that you could be useful for you, that is:

git pull --no-commit https://github.com/droark/cryptopp.git master

Unfortunately that's not the case, as of Git v1.9. I could not test this with a newer version, I recommend that you try.

Another thing that didn't work is using a fetch + merge like this:

git remote add droark https://github.com/droark/cryptopp.git
git fetch droark
git merge --no-commit droark/master

The same result, it wants a username and email configuration. It seems it does the configuration check a bit too early, as clearly there should be no commits made in this case. You may want to file a bug for this.

For the time being, it would appear that you just have to suck it up and set a username + email. You don't have to make it a global setting as the error message suggests, you can simply drop the --global flag.

Update

One more way to get the changes without committing is to cherry pick the range of commits that would be merged:

git remote add droark https://github.com/droark/cryptopp.git
git fetch droark
git cherry-pick --no-commit ..droark/master

This should work, and have the equivalent outcome.

janos
  • 120,954
  • 29
  • 226
  • 236
  • *"For the time being, it would appear that you just have to suck it up and set a username + email. ..."* - Negative. I don't work for the tools; the tools are supposed to work for me. I'll email Douglas and ask him for the files since its yet another case of Git making a simple task difficult to impossible. – jww Feb 28 '16 at 14:19
  • 2
    @jww You could have copy pasted the 2 lines in the error output and got on with your business in literally less than 10 seconds. Instead of doing that, you took the time to write up a question here to raise the issue, which obviously took you far longer than the far easier Option A. It would appear that you are in fact working for the tools :-) Anyway, I think I found a solution for you, see my update. – janos Feb 28 '16 at 14:26
  • Thanks Janos. Option A was a false choice since there is no information to provide. Its kind of like the answer to this question: [How to delete “Google My Business” information that is not mine but its associate with me?](http://webapps.stackexchange.com/q/89907). In that Q&A, someone told me to pretend it was mine so I could delete the incorrect association (with unknown legal consequences). Surely I'm not the only person who is mindful of details, and wants things to be accurate and correct in practice. – jww Feb 28 '16 at 14:43
  • Thanks again Janos. The `remote add` and `cherry pick` worked. Thank you very much. – jww Feb 28 '16 at 14:50