Torch. hub and private repos - private-repository

I want to use models from a private repository, that I have access to, with torch.hub.load, but I get HTTP error 404: not found.
I tried setting $GITHUB_TOKEN env variable, but it didn't help. Is there a way to make this work.
Btw, if I change the repo to public, it works well, but I need it to be private.

Related

Github enterprise webhook - localhost not recheable over Internet error

After upgrading githubEnterprise from 2.19.4 to 3.0.25 one issue appeared.
When I try to create git webhooks with POST request from my local instance or from my CI machine I receive response from git:
{"message":"Validation Failed","errors":[{"resource":"Hook","code":"custom","message":"Sorry, the URL host localhost is not supported because it isn't reachable over the public Internet"}],"documentation_url":"https://docs.github.com/enterprise/3.0/rest/reference/repos#create-a-repository-webhook"}
I know the root cause - creating webhook with localhost callback, but I would like to keep it as it worked before.
I've tried to find some setting/property to set in the config to force github instance to accept that url but I haven't found anything.
Do you know how to tell github to accept this callback urls or any workaround?I don't want to change my tests and CI. I want to configure github that way.
P.S. I've found POST with explanation this behaviour but there is no solution.

Typicode My json server shows "404 error Oops, can't find db.json file on main or master branch. Try to create one and retry."

I had configured JSON server and created a db.json file and even added in some data, everything worked fine so I pushed it to Github, I replaced my localhost JSON server port URL with the one of typicode i.e https://my-json-server.typicode.com/myGithubUsername/myRepository/resource and tested again, still, things worked but after changing my GitHub repository to private am now getting this when I try to access the resource!
404 error Oops, can't find db.json file in myGithubUsername/myRepository/resource on main or master branch. Try to create one and retry.
I changed my GitHub repository back to public and it solved the
problem but this was for my employees so it shouldn't remain public, I
don't know if anyone has a better way to fix this, but this worked!

Is there a way in Terraform Enterprise to read the payload from VCS?

I have configured a webhook between github and terraform enterprise correctly, so each time I push a commit, the terraform module gets executed. Why I want to achieve is to use part of the branch name where the push was made and pass it as a variable in the terraform module.
I have read that the value of a variable can be a HCL code, but I am unable to find the correct object to access the payload (or at least, the branch name), so at this moment I think it is not possible to get that value directly from the workspace configuration.
if you get a workaround for this, it may also work from me.
At this point the only idea I get is to call the terraform we hook using an API Call
Thanks in advance
Ok, after several try and error I found out that it is not possible to get any information in the terraform module if you are using the VCS mode. So, in order to be able to get the branch, I got these options:
Use several workspaces
You can configure a workspace for each branch, so you may create a variable a select that branch in each workspace. The problem is you will be repeating yourself with this option
Use Terraform CLI and a GitHub action
I used these fine tutorial from Hashicorp for creating a Github action that uses Terraform Cloud. It gets you done the 99% of the job. For passing a varible you must be aware that there are two methods, using a file or using an enviromental variable (check that information on the Hashicorp site here). So using a:
terraform apply -var="branch=value"
won't work. In my case I used the tfvars approach, so in my Github Action I put this snippet:
- name: Setup Terraform variables
id: vars
run: |-
cat > terraform.auto.tfvars <<EOF
branch = "${GITHUB_REF#refs/*/}"
EOF
I defined a variable within terraform called branch, I was able to get and work with this value

How to push to a local remote?

I'm having a hard time pushing my commits to a remote repository with libgit2sharp. Using the git bash it works fine.
The remote is addressed via UNC like "//computer_name/remote.git". So it's a folder on a machine in the local network which has an accessible folder.
Cloning it to a local repo with libgit2sharp worked just fine and constructing a remote was successful too with
Remote remote = localrepo.Network.Remotes["origin"];
Now when I try pushing to the remote with:
localrepo.Network.Push(remote, "HEAD", "origin");
I get the exception in git_push_add_refspec() in Proxy.cs
An error was raised by libgit2. Category = Invalid (Error).
Not a valid reference 'origin'
So then I tried:
repo.Network.Push(remote, "HEAD", #"refs/remotes/origin/master");
and got the exception in git_push_finish() in Proxy.cs
An error was raised by libgit2. Category = Net (Error).
Remote transport doesn't support push.
Is there a right way to do this or is there a support problem for my usecase?
Thanks in advance!
[UPDATE]
Now my command looks like this
repo.Network.Push(remote, "HEAD", #"refs/remote/origin/master", pushStErrHnd, null);
The PushStatusErrorHandler has only one line of code in which it should write the PushErrorStatus to console. But console remains blank and then the above exception occurs.
[UPDATE 2]
The static variable Repository.Version was 0.9.5 when I experienced the above.
As nulltoken has already mentioned, local push has just recently been added. You will need to make sure that you have a recent LibGit2Sharp build (you will need LibGit2Sharp containing commit 547a6bd, committed on March 12)
Also, there is a slight mistake in the API usage. The destination reference should be the reference to update on the remote (e.g. #"refs/remote/origin/master" should probably be #"refs/heads/master").
Push to a local repository has been recently added to libgit2 (see PR #1406) and eventually embedded in LibGit2Sharp. However, this feature hasn't been properly tested yet.
In order to try and help you, could you please update your questions with the answers to the few questions below:
Push accept an additional parameter to give more information about issues: onPushStatusError. Could you please provide the output of each potential PushStatusErrors?
You state "Cloning it to a local repo worked". How did you perform the clone? Through git? Through LibGit2Sharp?
What happens if you change the url of the remote to a file URI format (eg. file://computer_name/remote.git)?
UPDATE
The amazing #yorah is working on a Pull Request to enhance the test coverage regarding your scenario.
Cloning from a local repository
Adding a new Commit
Pushing the newly created commit
Retrieving the list of the remote references

Connecting TeamCity VCS Root with a GitHub repository using a private key

I been trying for about three hours to create a VCS Root pointing to a Github repository using "Private Key" as the the Authentication method.
But when I hit the "Test Connection" button I get this error back:
List remote refs failed: com.jcraft.jsch.JSchException: invalid
privatekey: C:\Users\Administrator.ssh\EC2BuildServerPrivateKey.ppk
The private key definitely exists, and I've even cloned the repository using this same key using GIT extensions.
Surely I'm not the first one to try and use github as a VCS root!? I'm using Team City 7.1.3!
Can anyone please please help with some suggestions of things to verify?
Maybe I should be using some other "Authentication method" as this one doesn't work?
I'm pretty confident that TeamCity requires an OpenSSH private key and won't work with a private key in PuTTY Private Key format (.ppk).
You can convert your private key using the PuTTY Key Generator GUI that ships with PuTTY.