从存储库开始,github该存储库长期以来一直保留一个分支master。在某个时候,我在 github 的同一个地方创建了一个新的:
然后使用将其在本地合并到一个新文件夹中
git clone --branch serverBranchName https://github.com/username/reponame/
进行更改后,继续按以下顺序推送:
混帐添加。
git commit -m "测试味精"
git 添加远程来源https://github.com/username/reponame/
git checkout -b serverBranchName
git branch --set-upstream-to=origin/serverBranchName serverBranchName
git push origin/serverBranchName
我得到的是一个错误:
Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
我拥有所有权利,我通过 ssh 连接,但仍然无法将更改上传到新分支。远程名称和本地名称brach相同。谁面对 - 告诉我这是怎么回事?

要完成您描述的任务,在您从master分支创建一个单独的new_Branch分支之后就足够了:
在您的任务上下文中,我不清楚目的的命令:
git clone --branch new_Branch https://github.com/username/reponame/- 你应该返回一个错误。因为 您之前创建了一个new_Branch分支,并指定p2p_chat_opengit remote add origin https://github.com/username/reponame/- 在克隆命令之后,原点已经设置为此。多余。git checkout -b serverBranchName-从当前分支创建另一个分支serverBranchName并切换到它。git branch --set-upstream-to=origin/serverBranchName serverBranchName- 指定当前分支serverBranchName 为tracked 并将其链接到远程服务器上同名的分支。git push origin/serverBranchName- 将当前serverBranchName分支推送到远程服务器到origin/serverBranchName 分支,但是您在远程服务器上没有这样的分支,并且您收到错误响应。