创建后,Git分支不存在或没有权限

时间:2018-12-03 11:18:55

标签: git github git-branch

我创建了一个分支,并运行以下命令:

git push [branchname]

我知道了

fatal: The current branch [branchname] has no upstream branch.
To push the current branch and set the remote as upstream, use

git push --set-upstream [branchname] [branchname]

然后我跑了

git push --set-upstream [branchname] [branchname]

我知道了

fatal: [branchname] does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

我该如何解决?我希望有一个终端解决方案,谢谢!

1 个答案:

答案 0 :(得分:0)

您的本地分支似乎没有上游。首先,使用

找出您的远程跟踪存储库
git remote -v

大多数时候你会得到

origin git@xxx (fetch)
origin git@xxx (push)

这意味着您有一个名为origin的遥控器。因此,您可以使用

将本地分支推送到远程
git push origin <local_branch_name>