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

can't clone a newly created repo #344

Closed
gitblit opened this issue Aug 12, 2015 · 20 comments
Closed

can't clone a newly created repo #344

gitblit opened this issue Aug 12, 2015 · 20 comments

Comments

@gitblit
Copy link
Collaborator

gitblit commented Aug 12, 2015

Originally reported on Google Code with ID 48

What steps will reproduce the problem?
1. installed as war
2. creating empty git repo as tst.git eg.
3. trying to clone it using git version 1.7.4.1, eg:  git clone http://admin:admin@localhost:8080/gitblit/git/tst.git

(note, I tried other gitRepositories place, full or relative bath as well)

What is the expected output? What do you see instead?

I'd see the cloned reposiory cloned, instead I see:

xxx@yyy:~$ git clone http://admin@localhost:8080/gitblit/git/tst.git
Cloning into tst...
Password:
error: The requested URL returned error: 400 while accessing http://admin@localhost:8080/gitblit/git/tst.git/info/refs

fatal: HTTP request failed


What version of the product are you using? On what operating system?

gitblit 0.8.2 war dist.
Please provide any additional information below.

HTH,

Tamas

Reported by toma@rulez.org on 2012-01-25 12:37:34

@gitblit
Copy link
Collaborator Author

gitblit commented Aug 12, 2015

I can't reproduce your issue.

Please double-check the repository URL on the Empty Repository page of tst.git (click
tst from the repositories page).  I would use the copy-to-clipboard button on the summary
page to ensure that the URL is the correct one.

Reported by James.Moger on 2012-01-25 12:58:47

@gitblit
Copy link
Collaborator Author

gitblit commented Aug 12, 2015

CATALINA_OPTS="${CATALINA_OPTS} -Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true"
CATALINA_OPTS="${CATALINA_OPTS} -Dweb.mountParameters=false"
CATALINA_OPTS="${CATALINA_OPTS} -Dweb.forwardSlashCharacter=!"

has been also set based on faq accordingly.

Reported by toma@rulez.org on 2012-01-25 13:12:17

@gitblit
Copy link
Collaborator Author

gitblit commented Aug 12, 2015

Those settings only affect the web ui, they do not affect git repository serving.

Reported by James.Moger on 2012-01-25 13:17:13

@gitblit
Copy link
Collaborator Author

gitblit commented Aug 12, 2015

I hope this might help:

$ unset http_proxy; wget --http-user=admin --http-password=admin http://localhost:8080/gitblit/git/tst.git
-O-
--2012-01-25 14:22:36--  http://localhost:8080/gitblit/git/tst.git
Resolving localhost... 127.0.0.1
Connecting to localhost|127.0.0.1|:8080... connected.
HTTP request sent, awaiting response... 404 Not Found
2012-01-25 14:22:36 ERROR 404: Not Found.

but however I set to DEBUG, i can't see usable related message to this issue.


Reported by toma@rulez.org on 2012-01-25 13:24:10

@gitblit
Copy link
Collaborator Author

gitblit commented Aug 12, 2015

So you are running Gitblit behind a proxy?

Reported by James.Moger on 2012-01-25 13:33:06

@gitblit
Copy link
Collaborator Author

gitblit commented Aug 12, 2015

no, making sure that it is hit directly.

Reported by toma@rulez.org on 2012-01-25 13:35:38

@gitblit
Copy link
Collaborator Author

gitblit commented Aug 12, 2015

First issue, that web.xml is in mixed mode (several lines contain \r as well), so removed
it, I got a new error message:

unset http_proxy; wget --http-user=admin --http-password=admin http://localhost:8080/gitblit/git/tst.git
-O-
--2012-01-25 14:39:46--  http://localhost:8080/gitblit/git/tst.git
Resolving localhost... 127.0.0.1
Connecting to localhost|127.0.0.1|:8080... connected.
HTTP request sent, awaiting response... 500 Internal Server Error
2012-01-25 14:39:46 ERROR 500: Internal Server Error.

checking with browser:

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling
this request.

exception

javax.servlet.ServletException: /home/toma/local/apache-tomcat-6.0.33/webapps/git (for
base-path) not found
    org.eclipse.jgit.http.server.GitServlet.getFile(GitServlet.java:305)
    org.eclipse.jgit.http.server.GitServlet.init(GitServlet.java:213)
    com.gitblit.GitServlet.init(GitServlet.java:98)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:291)
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
    org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
    org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    java.lang.Thread.run(Thread.java:662)

note The full stack trace of the root cause is available in the Apache Tomcat/6.0.33
logs.

any idea from here?

(please also make sure that you don't use any mixed new-line chars)

Reported by toma@rulez.org on 2012-01-25 13:42:01

@gitblit
Copy link
Collaborator Author

gitblit commented Aug 12, 2015

Things to check:
1. Did you ever set git.repositoriesFolder ?
2. It looks like I packaged an older JGit and the current JGit.  This could contribute
to that stack trace.  Delete two jars from lib: org.eclipse.jgit...1.1....jar

I'm not sure that the line endings matter to Java, but I'll keep it in mind.

Reported by James.Moger on 2012-01-25 13:55:27

@gitblit
Copy link
Collaborator Author

gitblit commented Aug 12, 2015

another problem, with 

                <param-name>git.repositoriesFolder</param-name>

it was relative path:

                <param-value>git</param-value>

now I changed it to:

                <param-value>/home/toma/local/apache-tomcat-6.0.33/webapps/gitblit/git</param-value>

because the relative path at repository creating is under the webapps/gitblit/git is
created, but when browsing, it tries to webapps/git under CATALINA_HOME. Interesting.

But this also led to another issue, I can check it out, but cannot push changes:


in log:

INFO  ARF: tst.git/info/refs?service=git-upload-pack (100) authenticated
INFO  ARF: tst.git/info/refs?service=git-upload-pack (100) authenticated
INFO  ARF: tst.git/info/refs?service=git-receive-pack (100) authenticated
INFO  ARF: tst.git/git-receive-pack (100) authenticated
ERROR GitBlit.getRepository(String) failed to find /home/toma/local/apache-tomcat-6.0.33/webapps/gitblit/git/t-6.0.33/webapps/gitblit/git/tst.git

it seems a bit garbled in contrast of the full path settings, here is the git client
activity:

$ git remote add gitblit http://admin:adminlocalhost:8080/gitblit/git/tst.git

$ git sh
commit 933276da229ca45f9195ccc104864825354e6c3e
Author: Tamas SZERB <xxx>
Date:   Wed Jan 25 14:54:15 2012 +0100

    moo

diff --git a/README.TXT b/README.TXT
new file mode 100644
index 0000000..eec8c88
--- /dev/null
+++ b/README.TXT
@@ -0,0 +1 @@
+moo
$ git push gitblit master
Counting objects: 3, done.
Writing objects: 100% (3/3), 218 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
error: RPC failed; result=22, HTTP code = 500
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly

Reported by toma@rulez.org on 2012-01-25 14:00:23

@gitblit
Copy link
Collaborator Author

gitblit commented Aug 12, 2015

Hmm.  I would not put your repositories in the webapp folder.  They will get destroyed
on the next redeploy of your WAR. maybe put them in /home/toma/repos or something like
that.

Reported by James.Moger on 2012-01-25 14:08:14

@gitblit
Copy link
Collaborator Author

gitblit commented Aug 12, 2015

checked, but as I mentioned, garbled file cause issues:

ERROR GitBlit.getRepository(String) failed to find /home/toma/repositories/e_4/toma/repositories/tst.git

however it is located in /home/toma/repositories/tst.git .

I believe it is String operation error somewhere, could you suggest how to fix it?

Reported by toma@rulez.org on 2012-01-25 14:56:26

@gitblit
Copy link
Collaborator Author

gitblit commented Aug 12, 2015

I agree that the "garbled file" is a problem, but I think it is a symptom, not the cause.

Have you removed the 1.1 JGit jars?

If you have then humor me and download GO (also remove the 1.1. jars from that since
they are also incorrectly included) and configure git.repositoriesFolder and realm.userService.

There are too many variables.  We need to simplify the test scenario.

Reported by James.Moger on 2012-01-25 15:12:55

@gitblit
Copy link
Collaborator Author

gitblit commented Aug 12, 2015

deleted:
apache-tomcat-6.0.33/webapps/gitblit/WEB-INF/lib$ rm org.eclipse.jgit-1.1.0.201109151100-r.jar
org.eclipse.jgit.http.server-1.1.0.201109151100-r.jar

now other issue, I can't even clone:

$ git clone http://admin:admin@localhost:8080/gitblit/git/tst.git
Cloning into tst...
error: The requested URL returned error: 400 while accessing http://admin:admin@localhost:8080/gitblit/git/tst.git/info/refs

fatal: HTTP request failed

in logs:

ERROR /home/toma/repositories/tst.git failed to get commit HEAD
java.lang.NullPointerException
        at org.eclipse.jgit.lib.ObjectIdOwnerMap.get(ObjectIdOwnerMap.java:131)
        at org.eclipse.jgit.revwalk.RevWalk.parseAny(RevWalk.java:809)
        at org.eclipse.jgit.revwalk.RevWalk.parseCommit(RevWalk.java:724)
        at com.gitblit.utils.JGitUtils.getCommit(JGitUtils.java:514)
        at com.gitblit.utils.JGitUtils.getLastChange(JGitUtils.java:461)
        at com.gitblit.GitBlit.getRepositoryModel(GitBlit.java:762)
        at com.gitblit.GitBlit.getRepositoryModel(GitBlit.java:733)
        at com.gitblit.GitBlit.getRepositoryModels(GitBlit.java:702)
        at com.gitblit.wicket.pages.RootPage.getRepositories(RootPage.java:297)
        at com.gitblit.wicket.pages.RepositoriesPage.setup(RepositoriesPage.java:80)
        at com.gitblit.wicket.pages.RepositoriesPage.<init>(RepositoriesPage.java:47)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at org.apache.wicket.session.DefaultPageFactory.createPage(DefaultPageFactory.java:192)
        at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:57)
        at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.newPage(BookmarkablePageRequestTarget.java:298)
        at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.getPage(BookmarkablePageRequestTarget.java:320)
        at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.processEvents(BookmarkablePageRequestTarget.java:234)
        at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
        at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1252)
        at org.apache.wicket.RequestCycle.step(RequestCycle.java:1331)
        at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1438)
        at org.apache.wicket.RequestCycle.request(RequestCycle.java:546)
        at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486)
        at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:319)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:291)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Thread.java:662)

It seems you're right, so it should be an underlying issue.

Reported by toma@rulez.org on 2012-01-25 15:23:56

@gitblit
Copy link
Collaborator Author

gitblit commented Aug 12, 2015

Try GO (minus JGit 1.1).
Let's also delete the tst repo and make a new one in case it got corrupted somehow.

Reported by James.Moger on 2012-01-25 15:30:35

@gitblit
Copy link
Collaborator Author

gitblit commented Aug 12, 2015

dl'ed go version zip, removed jgit, erased git repo, created repo in go, and same issue.
I'm happy about it, since at least we have consistent behaviour.

what do you think, how to move forward?

Tamas

Reported by toma@rulez.org on 2012-01-25 15:48:50

@gitblit
Copy link
Collaborator Author

gitblit commented Aug 12, 2015

java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03, mixed mode)

Reported by toma@rulez.org on 2012-01-25 15:50:53

@gitblit
Copy link
Collaborator Author

gitblit commented Aug 12, 2015

I have to move on today so I'll give it some thought.

Reported by James.Moger on 2012-01-25 15:57:24

@gitblit
Copy link
Collaborator Author

gitblit commented Aug 12, 2015

I still can not reproduce your problem.
The following is exactly the steps I took and the exact commands that I executed.

I would be interested in your results following *exactly* the same recipe - especially
the URLs.


New user account on PC-BSD 9.0 running Git 1.7.8.3, OpenJDK 1.6.0_24

1. Download and extract GO 0.8.2
2. Remove JGit 1.1 jars
3. gitblit.properties modify only
   server.httpPort = 8080
4. java -jar gitblit.jar
5. browse to http://localhost:8080
6. create repository named "test", leave everything at defaults
7. git clone http://localhost:8080/git/test.git
   Cloning into 'test'...
   warning: You appear to have cloned an empty repository.
8. cd test
9. nano afile
10. git add afile
11. git commit -m "test commit"
    1 files changed, 1 insertions(+), 0 deletions(-)
    create mode 100644 afile
12. git push origin master
    Counting objects: 3, done.
    Writing objects: 100% (3/3), 229 bytes, done.
    Total 3 (delta 0), reused 0 (delta 0)
    remote: Updating references: 100% (1/1)
    To http://localhost:8080/git/test.git
     * [new branch]      master -> master
13. cd ..
14. git clone https://localhost:8443/git/test.git test2
    Cloning into 'test2'...
    error: Failed to connect to ::1: Connection refused while accessing https://localhost:8443/git/test.git/info/refs
    fatal: HTTP request failed
15. git config --global --bool --add http.sslVerify false
16. git clone https://localhost:8443/git/test.git test2
    Cloning into 'test2'...
    remote: Counting objects: 3, done
    remote: Finding sources: 100% (3/3)
    remote: Getting sizes: 100% (2/2)
    remote: Compressing objects: 100% (1/1)
    Unpacking objects: 100% (3/3), done.
    remote: Total 3 (delta 0), reused 3 (delta 0)
17. cd test2
18. nano afile
19. git add afile
20. git commit -m "test commit 2"
    1 files changed, 2 insertions(+), 0 deletions(-)
21. git push origin master
    Counting objects: 5, done.
    Writing objects: 100% (3/3), 275 bytes, done.
    Total 3 (delta 0), reused 0 (delta 0)
    remote: Updating references: 100% (1/1)
    To https://localhost:8443/git/test.git
       c79f91c..cfc3443  master -> master
22. cd ../test
23. git pull origin
    remote: Counting objects: 5, done
    remote: Finding sources: 100% (3/3)
    remote: Getting sizes: 100% (4/4)
    remote: Compressing objects: 100% (2/2)
    remote: Total 3 (delta 0), reused 3 (delta 0)
    Unpacking objects: 100% (3/3), done.
    From http://localhost:8080/git/test
       c79f91c..cfc3443  master     -> origin/master
    Updating c79f91c..cfc3443
    Fast-forward
     afile |    2 ++
     1 files changed, 2 insertions(+), 0 deletions(-)

Reported by James.Moger on 2012-01-25 17:42:47

@gitblit
Copy link
Collaborator Author

gitblit commented Aug 12, 2015

OK, you were right about the proxy. accidentally http_proxy was set, and git was unable
to fetch the repo. unsetting envvar, then it works like a charm. sorry about your effort.
It turned out when I wanted to fetch the localhost :)

cheers,

Tamas

Reported by toma@rulez.org on 2012-01-26 16:51:25

@gitblit
Copy link
Collaborator Author

gitblit commented Aug 12, 2015

Thanks for the status update.  Great news for us both.  :)

Reported by James.Moger on 2012-01-26 18:52:31

  • Status changed: Done

@gitblit gitblit closed this as completed Aug 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant