首次使用GitHub时,尝试"git push"时收到错误403 [英] First time using GitHub, getting error 403 when I try 'git push'

查看:56
本文介绍了首次使用GitHub时,尝试"git push"时收到错误403的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到以下错误

remote: Permission to sokratus/xxxxxxxxxxxxx.git denied to user-name2.
fatal: unable to access 'https://github.com/sokratus/xxxxxxxxxxxxx.git/': The requested URL returned error: 403

用户名2属于我的一个朋友,我不确定为什么它会出现在我的计算机上.

The user-name2 belongs to one of my friend and I'm not sure why is it coming up on my computer.

推荐答案

这是因为您正尝试推送到朋友的存储库&您无权这样做.这可能是您所做的:

This is because you are trying to push to your friend's repository & you do not have permission to do so. This is probably what you did:

git clone https://github.com/sokratus/xxxxxxxxxxxxx.git/
## did something, git add or git commit....
git push 

默认情况下,git push将信息推送到原点,您可以执行以下操作来检查原点指向的存储库:

By default, git push pushes to the origin, you can check the repository to which origin points to by doing :

$ git remote -v
# which will give you something like this
origin https://github.com/sokratus/xxxxxxxxxxxxx.git/ 

如果要推送到原点,则需要访问它.或者,如果要将其推送到自己的github存储库中,则需要创建一个新的遥控器,如下所示:

If you want to push to the origin, then you need access to it. Or if you want to push it to your own github repository, then you need to create a new remote, like this:

$ git remote add my_origin <your github repository's url>
$ git push my_origin 

这篇关于首次使用GitHub时,尝试"git push"时收到错误403的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆