不具合

remote: HTTP Basic: Access denied.

remote: HTTP Basic: Access denied. If a password was provided for Git authentication, the password was incorrect or you're required to use a token instead of a password. If a token was provided, it was either incorrect, expired, or improperly scoped. See https://gitlab.com/help/topics/git/troubleshooting_git.md#error-on-git-fetch-http-basic-access-denied
fatal: Authentication failed for 'https://hoge.com/hoge/hoge.git/'

gitを使うパソコンごとにトークンを作って、そのトークンをGitLabにログインして登録する必要があるようだ。 2026/4にこのエラーが出るようになったが、それまではパスワードでpullやpushができていた理由は不明。

パソコンごとにトークンを作って、GitLabに登録。

ssh-keygen -t ed25519 をやると
~/.ssh/id_ed25519(秘密鍵)
~/.ssh/id_ed25519.pub(公開鍵)ができる。
cat ~/.ssh/id_ed25519.pub で公開鍵を表示して、コピペしておく。
Are you sure you want to continue connecting (yes/no)? → yes
成功した場合:Welcome to GitLab, @ユーザー名!

これで、pullやpushをやって、パスワードを聞かれなければ成功。

ssh -T git@gitlab.comをやったら無反応

上記の

ssh -T git@gitlab.com

をやった後、無反応で止まってしまった場合、

ssh -vT git@gitlab.com

をやって、ログを見る(生成AIに原因を教えてもらう)。 その結果、SSHは完全に成功していて、鍵認証も通っていて、Entering interactive session.で止まっているということであれば、 以下をやってみる。

他のパソコンでgitで編集したのを忘れてpullする前に編集してしまったら、

他のパソコンでgitで編集したのを忘れてpullする前に一旦 編集してしまうと、 pullで戻そうとしても、

 * branch            master     -> FETCH_HEAD
hint: You have divergent branches and need to specify how to reconcile them.
hint: You can do so by running one of the following commands sometime before
hint: your next pull:
hint: 
hint:   git config pull.rebase false  # merge
hint:   git config pull.rebase true   # rebase
hint:   git config pull.ff only       # fast-forward only
hint: 
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
fatal: Need to specify how to reconcile divergent branches.

みたいなエラーが出て戻せなくなる。その場合は、pullする前に、

git stash
git pull --rebase

トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS