git push访问被拒绝

时间:2018-08-04 06:12:22

标签: git github gitlab git-push

我想在将git push到远程https时将凭据错误,因为我不确定要使用哪个凭据。

现在,每次我再次尝试时,都会收到错误消息:

  

远程:HTTP基本:访问被拒绝致命:身份验证失败   'https://

我应该使用什么凭证?如何再次尝试?

3 个答案:

答案 0 :(得分:1)

如果它是现有项目,请在Git Bash控制台窗口中导航到项目的根目录。仅键入以下内容以在本地创建存储库。

git init       (only do this when you first set up repository)

然后

git add YourFileName

git add *     (to add the whole directory and subdirectories)

然后

git commit -m "type some comments here within quotes"

(此时,登录github的网站并仅在第一次设置存储库的情况下创建存储库-创建回购协议后,从页面加载中复制并粘贴“ git remote add origin origin master url”看起来像这样:

git remote add origin https....    (only do this the when you first set up repository)

然后

git push origin master

现在从ON ..随时进行需要添加的更改...只需执行以下操作:

git add YourFileName
git commit -m "some comments about the changes made"
git push origin master

登录并查看存储库后,您将看到更改反映在Github的服务器上。

这是最低要求...另外,最好不要使用README进行初始化或忽略文件,直到所有这些操作都完成并且可以正常工作为止。

答案 1 :(得分:0)

这里是说明如何通过ssh将系统连接到GitHub的链接

https://help.github.com/articles/connecting-to-github-with-ssh/

并成功运行连接

  

git push origin master

答案 2 :(得分:0)

谢谢大家的想法,尝试之后,我发现我已经添加了一个来源,因此在删除我的GitLab帐户并再次创建它以放置正确的凭据后,这些是我遵循的步骤:

创建了一个新的远程git存储库:

git pull gitlab mybranch --allow-unrelated-histories

检查我的远程存储库:

git push gitlab mybranch

我还在远程gitLab中创建了一个与本地分支名称相同的分支:

id
  
      
  1. 按“ i”
  2.   
  3. 写您的合并消息。
  4.   
  5. 按“ esc”
  6.   
  7. 写“:wq”
  8.   
  9. 然后按Enter。
  10.   
id

我希望这可能有用。