我最近使用我的Github帐户在gitlab上创建了一个项目。
但是当使用gitbash克隆项目时(我将当前的ssh-key添加到gitlab帐户),shell会提示输入用户名/密码,从github输入我的用户名和密码会导致身份验证失败。 (也是电子邮件/密码失败)
我做错了什么?
答案 0 :(得分:1)
如果您尚未设置密码或受2FA保护,则需要通过GitLab帐户创建访问令牌。
api
作为新访问令牌的范围。
像对待密码一样对待您的访问令牌!将下一个访问令牌的范围保持在较低水平,并仅与您信任的人共享。
然后,尝试使用git push
登录。
## Init the local repo
mkdir test-to-connect
cd test-to-connect
git init
## Add your user name and email to Git.
git config --global user.name "Your name"
git config --global user.email "your-gl-account-email@example.com"
## Create a new private repo after pushing.
git remote set origin https://your-gl-instance-host.dev/your-username/your-new-project-slug
## Commit
git commit -m "Initial commit"
## Push to GitLab
git push origin
## Username for 'https://your-gl-instance-host.dev': your-username
## Password for 'https://your-username@your-gl-instance-host.dev' [REDACTED]