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

github mount error 422 not a valid tree #43

Open
yuvaldrori opened this issue May 3, 2014 · 8 comments
Open

github mount error 422 not a valid tree #43

yuvaldrori opened this issue May 3, 2014 · 8 comments

Comments

@yuvaldrori
Copy link

  1. Opened a new public repo.
  2. Created github personal auth key with default scopes.
  3. Mounted the repo with set key.
  4. Trying to add a file / create folder / edit a file I get the red triangle error:
    commit last_commit_hash
    Error: Invalid HTTP response: 422 tree.sha
    some_hash is not a valid tree
@creationix
Copy link
Owner

The github REST API I'm using acts really strange when the remote repo is not initialized. If you check the "Initialize this repository with a README" box when creating your repo, it will have an initial commit and tree and play much nicer with tedit. I'm not sure there is much I can do on my end since it's their API that's buggy around this area.

Once I implement proper git remotes with clone/pull/push, tedit will have the same capabilities as normal git.

@yuvaldrori
Copy link
Author

I did initiate it with a readme. I'll try to do a second commit and try
again.
On May 5, 2014 7:00 PM, "Tim Caswell" [email protected] wrote:

The github REST API I'm using acts really strange when the remote repo is
not initialized. If you check the "Initialize this repository with a
README" box when creating your repo, it will have an initial commit and
tree and play much nicer with tedit. I'm not sure there is much I can do on
my end since it's their API that's buggy around this area.

Once I implement proper git remotes with clone/pull/push, tedit will have
the same capabilities as normal git.


Reply to this email directly or view it on GitHubhttps://github.com//issues/43#issuecomment-42203771
.

@creationix
Copy link
Owner

Also, you can always reset tedit to factory settings by using the "Remove All" option. But make sure you've backed up your github token somewhere, because it will forget that too.

Eventually I'll integrate a proper oauth flow (if possible) for better UX.

If you're still having troubles, I may need more details list the actual XHR request in the network panel of the chrome app to see where the issue it. If you open chrome://extensions while tedit is open, you can get to devtools for the index.html page. Once open to the network tab, reload the app and it will record activity.

@yuvaldrori
Copy link
Author

I saved a .har file of the network log. How can I send it to you? I think it has the auth key in plain text.

@creationix
Copy link
Owner

It does. You can email it to me at [email protected]. I usually either
manually remove the auth token or invalidate the token after reporting bugs.

On Mon, May 5, 2014 at 1:39 PM, Yuval Drori [email protected]:

I saved a .har file of the network log. How can I send it to you? I think
it has the auth key in plain text.


Reply to this email directly or view it on GitHubhttps://github.com//issues/43#issuecomment-42221935
.

@yuvaldrori
Copy link
Author

Sent it to your email.
You do not have to delete the key, I just did not want it to be on an open issue on github.
I have a keybase.io invite if you are interested - I could have attached it encrypted.

@creationix
Copy link
Owner

Ok, I know what's wrong now.

I have long known that github doesn't allow creating empty trees. I have several workarounds in js-github to allow tedit to have empty folders locally and that worked for a long time. But recently (10 days ago) they added some validators to their API that rejects any requests containing hashes pointing to invalid objects.

Since the API forbids tedit from creating the empty tree on the folder, when you later try to update your root tree to contain the empty "src" folder, it's rejecting that update because it references a tree that doesn't exist in github.

As a workaround, don't create empty folders. You can create files in subfolders directly in tedit. Simply go to the root and create a new file like "src/app.js" and it will create the "src" folder if it's not there already.

Sorry for the trouble. Like I said, the Github API I'm using here is very buggy and I'm working on moving to a more traditional flow.

@yuvaldrori
Copy link
Author

Worked like a charm! Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants