FredrikNoren / ungit

The easiest way to use git. On any platform. Anywhere.
MIT License
10.45k stars 640 forks source link

Handling remote repositories not named "origin" #216

Closed PedroKTFC closed 11 years ago

PedroKTFC commented 11 years ago

(I've just realised I've been adding comments to a closed issue, 209, doh!)

I'm trying ungit on an existing local repository and it seems to create the tree for my repository which it flashes up but it then overwrites with the "Whooosh Something went wrong page" message. My console log shows the following. I wonder if it's something obvious you can quickly spot.

Thanks (I really like the look of ungit from the video)

"NetworkError: 400 Bad Request - http://localhost:8448/api/fetch" fetch (line (null)) "NetworkError: 400 Bad Request - http://localhost:8448/api/remote/tags?path=c%3A%5Cusers%5Cuser%5Cgit%5Cml1&socketId=6" tags?p...ketId=6 (line (null)) Error: Backend: /fetch, no-remote-specified

throw new Error('Backend: ' + path + ', ' + errorSummary);

ungit.js (line 7676) "NetworkError: 404 Not Found - http://www.gravatar.com/avatar/fa87f08eacb002614faa5ae1bd7e892a?default=404" fa87f0...ult=404 (line (null))

I've since done some analysis and found the following.

I think I've tracked down why it's happening although I've no idea how to cure it! The error is from the line:

Error: Backend: /fetch, no-remote-specified

which gives the clue! I have a remote specified for my repository as I push it to my host provider (as it happens I never pull). I commented out the line 7676 throw new Error('Backend: ' + path + ', ' + errorSummary); in ungit.js just to check things otherwise worked which they did. I then removed my remote definitions and the error doesn't occur, confirming it's having the remote defined that is the cause. Why though I don't know. One other thing is that my remote definition uses ssh to enable the connection to the remote system.

Any ideas? I'm happy to do some testing if it helps.

FredrikNoren commented 11 years ago

Thanks for a very detailed and nice bug report!

Ungit tries to automatically fetch nodes from your remote when it starts, so one solution could be to turn that off (not available yet but there's an issue tracking the progress here: #214, and it should be an easy fix so should be available in the next version).

On the other hand ungit shouldn't crash just because git commands doesn't work so I'll probably look into doing something nicer for that too.

Btw if you type git fetch in the console, does that result in an error for you too? (just to verify)

PedroKTFC commented 11 years ago
Gee!

(I've done lots of s/w work in my time and I know well how useless the statement "it doesn't work" is!)

Anyway, I tried a simple "git fetch" which gave me the error "fatal: No remote repository specified". But if I tried "git fetch remotename" it fetched quite happily.

nroose commented 11 years ago

Perhaps it will work if you name one remote "origin"?

On Saturday, September 28, 2013, PedroKTFC wrote:

Gee!

(I've done lots of s/w work in my time and I know well how useless the statement "it doesn't work" is!)

Anyway, I tried a simple "git fetch" which gave me the error "fatal: No remote repository specified". But if I tried "git fetch remotename" it fetched quite happily.

— Reply to this email directly or view it on GitHubhttps://github.com/FredrikNoren/ungit/issues/216#issuecomment-25306483 .

PedroKTFC commented 11 years ago

Yep, it does. But I don't want to if I can avoid it. I'll try it for now and see if there are any adverse impacts.

Thanks as ever.

FredrikNoren commented 11 years ago

Ah ok, so this issue should probably be about ungit handling, or at least not crashing, on "named" remotes (i.e. not called "origin"); I'll update the title