简体   繁体   中英

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?

# 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

this should work.

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 -u origin prd

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM