milke / GitFinder-Issues

Bug and issue tracker for GitFinder - git client with macOS Finder integration
16 stars 1 forks source link

GitLab self hosted error #104

Closed msiuka closed 1 year ago

msiuka commented 2 years ago

I tried using GitFinder with self hosted GitLab server with personal access token. This is not working and showing "401 unathorized" error. I use this repository in xCode where i specify host, username and token. GitFinder hasn't field where i can specify username of self hosted GitLab server. But after i add cloned repository in GitFinder and pull changes it request enter username and password where i specify my username and token. It's pulled changes.

milke commented 2 years ago

@msiuka, first an explanation why GitFinder successfully cloned and pulled changes into a repository, even though you didn't succeed to login into a hosting service on the picture below:

Screen Shot 2021-10-12 at 16 28 27

Logging into some hosting service in the Preferences > Hosting is not necessary in order to work with remote repositories in GitFinder. You can always clone a repository in GitFinder, if you enter its remote URL, just like in the picture below:

Screen Shot 2021-10-12 at 16 30 34

Or if you already have a cloned repository locally, GitFinder will get its remote URL from repository configuration and access/connect to it (and it may ask your for credentials, such are username and password, like it happened to you, or a private SSH file for SSH connections). So that's why cloning and pulling worked for you in GitFinder, regardless of 401 unathorized error.

Logging into a hosting service in Preferences > Hosting just gives you some conveniences, like seeing a list of all your repositories on that server, easily creating new and cloning existing repositories with just one click, managing your SSH keys… And if a repo has a remote on some hosting service you're logged in in Preferences > Hosting, you can work with pull requests in that repository directly in GitFinder.

Now, about the error you get… To my experience, when accessing GitHub or GitLab hosting services with personal access token (PAT), the token itself is completely sufficient and username is not required. The type of token is Bearer and it requites only PAT, not any username. I tested this with official servers on github.com and gitlab.com. as well as on a couple of self hosted GitHub and GitLab instances on private servers. Are you sure you typed in the correct PAT, when you got that 401 unathorized error? If you're sure you typed the correct PAT and the error persists, would it be possible for you to create a restricted account on that self-hosted GitLab instance and allow me to access it? That way I could test and reproduce the issue myself and fix it. All official and self-hosted GitLab instances I have access to work without requiring a username, so I can't reproduce this.

milke commented 1 year ago

Closing due to inactivity.