5

I'm trying to manage a pull request on a repo that I don't own but have admin rights on. When I attempt to pull in changes from another fork, it fails with an error that is less than clear. Here is my workflow...

  1. Fork main repo
  2. Make changes in that fork
  3. Commit to that fork
    3.5 (goto step 2)
  4. Submit a pull request to the main repo

As an administrator of the main repo, I'm attempting to merge those changes as follows...

  1. git clone git@github.com:dude/project.git
  2. git checkout -b gtracy-master master
  3. git pull http://gtracy@github.com/gtracy/project.git master

After entering my password, I get the error message...

error: The requested URL returned error: 401 while accessing 
http://gtracy@github.com/gtracy/project.git/ifno/refs

Is this workflow wrong? Is there an easier way to manage my own pull requests?

Thanks!

Mu Mind
  • 10,935
  • 4
  • 38
  • 69
Greg
  • 2,559
  • 4
  • 28
  • 46

1 Answers1

7

The GitHub "pull request" help page don't mention it, but I prefer rebasing my work done in a fork on top of the branch from the original repo before submitting any pull request.
That is, I would add the original repo as a remote, fetch the branch to which my pull request will eventually apply, and rebase first my work locally (within my fork) on top of that branch.
That way I make sure all my pull requests will be fast-forwards one.

In your case though, that may not apply if you know that no changes has been published in the original repo since you have forked and worked on your local repo.

For your second part, I would follow the "Merging pull request" part, and add your forked repo as a remote of your original repo clone.

That being said, error 401 "Unauthorized" is mentioned in the GitHub Smart HTTP page:

Don't forget the https part - Git will send your password hashed but unencrypted over the wire, so be sure to use SSL.
In future versions of Git (assuming our patch gets integrated), Git will prompt you for your username if it's not provided and the client gets a 401, so you won't actually have to put your username in the URL - it will just ask you when Git needs it.

So if you want to use the username in your address, try with https.
Or try with http://github.com/gtracy/project.git (public repo address)

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Looks like there me be a problem with my git install. I couldn't get https to work - "error setting certificate verify location" - and I'm experimenting with 'git config' to set 'http.sslcainfo' without luck at the moment. – Greg Dec 17 '10 at 23:30
  • i've tried the following configuration... 'git config --system http.sslcainfo \bin/curl-ca-bundle.crt' and now 'git pull https : //gtracy@github.com/gtracy/project.git master' produces the same 401 error again?! – Greg Dec 17 '10 at 23:34
  • @Greg: strange (is there a problem with your account/password related with that repo?) And with a public address with http? – VonC Dec 17 '10 at 23:41
  • I was never able to get this working via https. However, I can successfully pull with 'git@github:gtracy/project.git'. I'm misunderstanding some github magic here somewhere... but time to move on. – Greg Dec 20 '10 at 19:12
  • @Greg: all right, but pull and push have two different requirements. You need some kind of server to listen to a push. https for push means smart http. – VonC Dec 20 '10 at 19:59