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

how do you run it? #33

Open
CouldBeThis opened this issue Feb 18, 2022 · 3 comments
Open

how do you run it? #33

CouldBeThis opened this issue Feb 18, 2022 · 3 comments

Comments

@CouldBeThis
Copy link

Hi, Sorry for the stupid question. But how does one run this? I have not worked with go applications much and not at all on this machine so I installed golang from synaptic; I don't know if it's like python or ruby where you have to massage the environment sometimes; maybe I am just missing a component.

Below is what I did if it's of any interest (may not be) but what I am really hoping for is to learn:

  1. what are the dependencies, environment requirements etc? I have go version go1.10.4 linux/amd64; is it sufficient?
  2. how are you supposed to invoke it? presumably something needs to get put on the path..? I'm missing the step.

Any hints appreciated! :) Thank you for making and sharing a program to deal with this very tenacious problem in git.


Anyway first I tried installing via Go:

$ go get github.com/prydonius/karn/cmd/karn

# github.com/prydonius/karn/cmd/karn
go/src/github.com/prydonius/karn/cmd/karn/karn.go:16:5: app.Author undefined (type *cli.App has no field or method Author)
go/src/github.com/prydonius/karn/cmd/karn/karn.go:17:5: app.Email undefined (type *cli.App has no field or method Email)
go/src/github.com/prydonius/karn/cmd/karn/karn.go:19:15: cannot use commands() (type []cli.Command) as type []*cli.Command in assignment
go/src/github.com/prydonius/karn/cmd/karn/karn.go:28:10: cannot use func literal (type func(*cli.Context)) as type cli.ActionFunc in field value
go/src/github.com/prydonius/karn/cmd/karn/karn.go:35:10: cannot use func literal (type func(*cli.Context)) as type cli.ActionFunc in field value
go/src/github.com/prydonius/karn/cmd/karn/karn.go:42:10: cannot use func literal (type func(*cli.Context)) as type cli.ActionFunc in field value

so I downloaded the binary but not sure what to do with any of these files. looked online for how to run golang programs and this was suggested:

$ go run karn.go
go run: cannot run non-main package

Looked into that error code and couldn't find anything that made sense.

Tried running it like anything else,

$ ./karn.go 
zsh: permission denied: ./karn.go

so gave some permissions:

$ chmod +x karn.go 
./karn.go       
./karn.go: package: not found
./karn.go: Syntax error: newline unexpected (expecting ")")

And I gave up. :)

@seltzered
Copy link

seltzered commented Jul 10, 2023

Did you first setup a karn.yml file per the readme in your home directory?

Generally it should work assuming you have karn.yml setup properly (you do also need signing keys currently setup until #31 is fixed). You may also need to make sure all identities are in your ~/.gitconfig

You can also try karn update if really needed, and you can check the email/name/etc. by cd'ing into the directory and doing:

git config user.name
git config user.email

If you need to refresh things you may want to try ssh-add -D (via https://stackoverflow.com/a/38583330/314780 )

Furthermore, when checking out a repo for a different identity you may need to specify the user
git remote add origin git@github-doe-company:username/repo.git (via https://stackoverflow.com/a/68025589/314780 )

All this said, it's worth noting there may be other options these days now that git itself supports conditional includes - see https://stackoverflow.com/a/43654115/314780 -> https://git-scm.com/docs/git-config#_conditional_includes

@CouldBeThis
Copy link
Author

Hi, thanks for following up. I must admit that I gave up on using this. But like you mention, git itself has been improving the built in functionality for multiple credentials. Also I am sloowly learning how to better use it. Between those factors I am mostly able to manage manually.

The one thing I can't do is clone a private repo. Because the git includes only apply when you are already in a repo. Is this application able to handle that situation?

It looks like I was still using Ubuntu when I made this issue. But now I have access to AUR so probably can bypass whatever the go problems were and install properly via system package manager the way god intended.

@seltzered
Copy link

I also stopped using Karn and now just use .gitconfig files (Karn worked, but for some odd reason it started asking for other identity permissions and wanted a simpler setup).

Cloning a private repo should depend more on your adding the identity when cloning: https://github.com/git-ecosystem/git-credential-manager/blob/main/docs/multiple-users.md#example-fresh-clones

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