首页 > 解决方案 > 我如何在新的远程分支上使用 git push?

问题描述

我有一个默认创建的第一个主分支。

我签出一个名为“prd”的新分支,我希望它推送到远程源,但在新分支上。

我试着做:

$ git push -u origin/prd prd

但是控制台记录了:

fatal: 'origin/prd' does not appear to be a git repository
fatal: Could not read from remote repository.

有人可以帮我吗?

标签: gitpushbranchremote-access

解决方案


# Create a new branch:
git checkout -b branch_name
# Edit, add and commit your files.
# Push your branch to the remote repository:
git push -u origin branch_name

这应该有效。


推荐阅读