Sebi
Sebi

Reputation: 9083

Git pushing to branch on remote repository doesn't work

I have two repositories origin and fork. I cloned origin locally and added fork as a remote repository. I now created a new local branch, e.g.:

git checkout master
git branch new
git checkout new

I made some changes to new and committed them locally. Now, I want to push my new branch to the fork repository. I tried the following:

git push fork new

However, this actually pushes to origin. The new branch is created in origin and not in fork. Why?

Upvotes: 0

Views: 121

Answers (2)

Karthik Bose
Karthik Bose

Reputation: 36104

Probably your remote 'fork' is pointing to wrong URL. You can get all information about your remote repo using this command:

git remote show <remote_name>

Upvotes: 1

Pedro Nascimento
Pedro Nascimento

Reputation: 13926

Add to your ~/.gitconfig:

[push]
    default = current

Upvotes: 1

Related Questions