This repository was archived by the owner on Nov 12, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 94
This repository was archived by the owner on Nov 12, 2025. It is now read-only.
Adding repos through API fails on indexing step #163
Copy link
Copy link
Closed
Description
Hi,
I'm playing with the API, setting up a small script to populate all of my repos. I'm using signed requests, sending URL's in the form of:
# generate vars
repourl = "https://github.com/issmirnov/dotfiles"
reponame = repourl.split("/")[-1].rstrip()
repotype = "git"
repousername = test
repopassword = test
reposource = repourl
repobranch = "master"
message = "pub=%s&reponame=%s&repourl=%s&repotype=%s&repousername=%s&repopassword=%s&reposource=%s&repobranch=%s" % (
urllib.quote_plus(publickey),
urllib.quote_plus(reponame),
urllib.quote_plus(repourl),
urllib.quote_plus(repotype),
urllib.quote_plus(repousername),
urllib.quote_plus(repopassword),
urllib.quote_plus(reposource),
urllib.quote_plus(repobranch)
)
sig = hmac(privatekey, message, sha512).hexdigest()
url = "%s/api/repo/add/?sig=%s&%s&hmac=sha512" % (base_url, urllib.quote_plus(sig), message)
Calling this URL returns added repository successfully, but when I check the repository/list/ I see that the file count for the repo is 0. I tested this by adding the exact same repo (same url, username/pass) using the /admin/repo/ interface and the indexer instantly found all 3 test files.
It seems that while the repo is added, some information is lost when using the API. For reference, the username/password I was using is test/test, so I don't think it's any ASCII decoding issues.
Extract from logs:
INFO: Thu Oct 26 20:21:55 PDT 2017: QuartzScheduler_Worker-40 49: Update found indexing https://github.com/issmirnov/dotfiles
WARNING: Thu Oct 26 20:21:55 PDT 2017: QuartzScheduler_Worker-40 49: ERROR - caught a class org.eclipse.jgit.api.errors.InvalidRemoteException in class com.searchcode.app.jobs.repository.IndexGitRepoJob updateGitRepository for dotfiles
with message: Invalid remote: origin
Metadata
Metadata
Assignees
Labels
No labels