GitHub:将本地分支推送到远程的问题

时间:2021-03-16 19:10:26

标签: git github

我创建了一个本地分支,但现在我正在努力将其推送到服务器。

编码后我做了:

git add .
git commit -m "message"

当我使用命令时:

git push -u origin name/feature

我有以下错误:

remote: Repository not found.
fatal: repository 'https://myUserName:myToken@github.com/githuburl/' not found

起初我认为问题出在我新生成的令牌上,但我在测试文件夹中克隆了 repo 对其进行了测试 - 它有效。

我错过了什么?

更新。分支名称包含一个斜杠 - 所以它看起来像“名称/功能”。

找到解决方案。原来我只有阅读权限,没有写作权限。

1 个答案:

答案 0 :(得分:1)

您尝试推送到的存储库 URI 不存在,或者您无权访问它(GitHub 假装您无权访问的私有存储库不存在)。运行

git remote get-url origin

并确保您看到的是正是点击绿色代码按钮后 GitHub 向您显示的内容:

Screenshot of GitHub UI displaying a clone URI