Search code examples
gitpushbranchremote-access

How i use git push on a new remote branch?


I had a first master branch created by default.

I checkout a new branch called 'prd', and i want it to push to remote origin, but a on new branch.

I tried to do :

$ git push -u origin/prd prd

But the console logged :

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

Can somebody help me with this ?


Solution

  • The -u flag is short for -set-upstream and it expects a repository name. In this case the repository has an alias origin. The second argument is the name of the branch.

    $ git push origin prd