Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

feat: git-credential store hack #718

Merged
merged 4 commits into from
May 14, 2021
Merged

feat: git-credential store hack #718

merged 4 commits into from
May 14, 2021

Conversation

profclems
Copy link
Owner

@profclems profclems commented May 12, 2021

Description

This add git credential helper interface to glab.

  • This sets up git HTTP(S) credentials after successfully logging in to glab.
→ gl auth login
? What GitLab instance do you want to log into? GitLab.com
- Logging into gitlab.com
? You're already logged into gitlab.com as profclems. Do you want to re-authenticate? Yes

Tip: you can generate a Personal Access Token here https://gitlab.com/profile/personal_access_tokens
The minimum required scopes are 'api' and 'write_repository'.
? Paste your authentication token: ********************
? Choose default git protocol HTTPS
? Authenticate Git with your GitLab credentials? Yes
? Choose host API protocol HTTPS
- glab config set -h gitlab.com git_protocol https
✓ Configured git protocol
- glab config set -h gitlab.com api_protocol https
✓ Configured API protocol
✓ Logged in as profclems
  • Depend on git credentials for pull/push/clone commands

Before

→ git pull
Username for 'https://gitlab.com':

After running glab auth login and enabling the credential helper

→ git pull
remote: Enumerating objects: 1, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (1/1), 272 bytes | 272.00 KiB/s, done.
From https://gitlab.com/xxx/xxx/xxx.git
   63c6589..08e0dbe  dev        -> origin/dev
Already up to date.

Related Issue

Resolves #661
Resolves #707
Resolves #596

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation
  • Chore (Related to CI or Packaging to platforms)

@profclems profclems added the enhancement New feature or request label May 12, 2021
@profclems profclems requested review from maxice8 and zemzale May 12, 2021 05:18
Copy link
Collaborator

@zemzale zemzale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work. Did some manual testing and nothing seemed to be broken so LGTM.

We don't need to use user credentials for pull/push/clone operations since the user can now opt to saving credentials to git-credential helper else, be prompted to login each time
@codecov
Copy link

codecov bot commented May 14, 2021

Codecov Report

Merging #718 (65a7d41) into trunk (ab717b5) will decrease coverage by 0.48%.
The diff coverage is 29.14%.

Impacted file tree graph

@@            Coverage Diff             @@
##            trunk     #718      +/-   ##
==========================================
- Coverage   59.46%   58.97%   -0.49%     
==========================================
  Files          90       92       +2     
  Lines        6535     6626      +91     
==========================================
+ Hits         3886     3908      +22     
- Misses       2277     2339      +62     
- Partials      372      379       +7     
Impacted Files Coverage Δ
commands/mr/create/mr_create.go 29.63% <0.00%> (+0.87%) ⬆️
commands/project/create/project_create.go 0.00% <0.00%> (ø)
commands/auth/login/login.go 40.00% <5.00%> (-2.03%) ⬇️
commands/auth/authutils/git_credentials.go 10.71% <10.71%> (ø)
commands/auth/login/helper.go 49.18% <49.18%> (ø)
commands/project/clone/repo_clone.go 62.22% <50.00%> (+0.41%) ⬆️
internal/config/config_type.go 68.92% <77.77%> (-0.20%) ⬇️
commands/auth/auth.go 100.00% <100.00%> (ø)
commands/auth/status/status.go 91.25% <100.00%> (ø)
internal/glrepo/repo.go 94.56% <100.00%> (-0.68%) ⬇️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ab717b5...65a7d41. Read the comment docs.

@profclems profclems merged commit 925d768 into trunk May 14, 2021
@profclems profclems deleted the git-credential-manager branch May 14, 2021 13:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request size/XL
Projects
None yet
3 participants