3
0

GitLabからgit cloneを行うも認証エラーが発生してクローンを行えない

Posted at

事象

先日、GitLabに格納してるプロジェクトをローカルで操作するために、
Git CMDからgit cloneを行うも、認証エラーが発生してしまった。

ググっても全く同じ事象が見つけられなかったので、
備忘録として残しておきます。

エラー内容は下記

Git CMDログ
Cloning into 'ほげほげプロジェクト'...
git: 'credential-manager-core' is not a git command. See 'git --help'.
remote: HTTP Basic: Access denied. The provided password or token is incorrect or your account has 2FA enabled and you must use a personal access token instead of a password. See https://gitlab.com/help/topics/git/troubleshooting_git#error-on-git-fetch-http-basic-access-denied
fatal: Authentication failed for 'https://gitlab.com/tokio-mori/management-function.git/'

原因

どうやら2FA認証をうまく突破できずに発生しているようでした。

解決法

ユーザー名はGitlabのアカウント名。
パスワードは発行したトークンを入力すれば突破できました。

トークン確認方法

  1. Gitlabでプロジェクトを開き、Setting → Access Tokensを押下します。
    image.png

  2. Add new tokenを押下
    image.png

  3. 下記入力して、Create project access tokenボタンを押下
    Token name:適当な名前
    Select a role:ご自身で作成されたプロジェクトでしたら、Ownerを選択
    Select scopes:apiのみチェックしておけばよさげ
    image.png

  4. ●●になっている箇所が発行されたトークン(パスワード)になっております。
    こちらをgit clone 時に表示されるパスワードに貼り付ければ突破できます。
    image.png

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0