Git命令提交远程分支

时间:2017-02-20 03:31:26

标签: git

我在本地计算机上创建了一个分支,然后在更改为change.html

后暂存
git checkout -b myBranch //create a branch in my local machine
git add change.html

然后我在github页面中创建了一个分支,名为" fix / remoteRepo"。 然后我按照为远程URL repo创建一个简短名称。

git remote add haeminsh https://github.com/mywork/fix/haeminish

然后将change.html提交到远程仓库,

git push myBranch haeminish

我收到以下错误:

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

有什么问题?我不想对主人进行任何更改,而是对我的远程仓库进行任何更改。

如何找到正确的网址?

1 个答案:

答案 0 :(得分:3)

您需要运行:git push <remote> <branch>。您的远程名称为haeminish,分支名称为myBranch

首先删除当前的远程haeminish,然后使用正确的网址添加haeminish

$ git remote rm haeminish        # remove remote haeminish

$ git remote add haeminish https://github.com/<username>/<reponame>.git  # add new 'haeminish' with correct url
# replace <username> & <reponame> with exact value

$ git push haeminish myBranch   
相关问题