不像这篇文章,我使用的是macOS。

我已经在GitLab中配置了密码。我也有一个SSL密钥创建后的项目是在GitLab。

当我在新项目中使用现有文件夹并执行以下步骤时,系统会提示我输入GitLab用户名和密码。

现有的文件夹

cd existing_folder
git init
git remote add origin https://gitlab.com/sobopla/Geronimod.git
git add .
git commit -m "Initial commit"
git push -u origin master

输入密码后,我得到以下错误。

remote: HTTP Basic:拒绝访问 致命:“https://gitlab.com/myname/myproject”认证失败


当前回答

我得到了同样的错误,我解决了这个:

打开Windows搜索 类型:Git Bash 单击鼠标第二个按钮,选择“以管理员身份运行” 进入项目目录:cd "C:\path\to\our\project\name" 执行命令:git config——system——unset credentials .helper 注意:在linux下使用sudo命令运行此命令:sudo git config——system——unset credential.helper

其他回答

我有同样的问题,我遵循这些步骤,它已经解决了。 步骤1:—设置用户名和密码 步骤2:- git push -f origin

以管理员身份打开命令提示符,然后执行以下命令:

git config --system --unset credential.helper

您可以尝试以下命令:

git config --system --unset credential.helper

然后,输入Git远程服务器的新密码。

奇怪的是,对我有效的方法是退出并重新登录到GitLab web UI。

我完全不知道为什么会这样。

对我来说,我创建了一个个人访问令牌,然后更新了我的git起源,如下所示:

https://<personal_access_token_name>:<personal_access_token>@gitlab.com/username/your-project.git