-1

I am new to git and want to push all the files in a branch in git for the first time.There are no changes sitting on that branch currently.

My commands are like below

  1. git add .
  2. git commit -m 'First time commit to staging'
  3. git push origin Staging

And I got the below error --

error: src refspec Staging does not match any.
error: failed to push some refs to 'https://****@bitbucket.org/***/***.git'

Any help is highly appreciated.

Liam
  • 25,247
  • 27
  • 110
  • 174
Prithviraj Mitra
  • 9,394
  • 12
  • 51
  • 87

5 Answers5

2

Only for the first time. Note that "your_branch_name" part you need to replace. Rest is same (most likely!).

git push --set-upstream origin your_branch_name
qqqqq
  • 797
  • 12
  • 29
1

Use below command if you first time pushing your repo to remote -

git pull --rebase
git push

The full syntax is:

git pull --rebase origin master
git push origin master
aziz
  • 307
  • 1
  • 18
0

If you want to create a new branch just use the command:

git checkout -b [branchname]

If you want to push the code then use:

git push origin [branchname]

vikscool
  • 1,283
  • 1
  • 10
  • 23
Sumanth Madishetty
  • 2,985
  • 1
  • 10
  • 23
0

I think you are working by default on master (you didn't say you created a branch) so you should push like this

git push origin master:Staging
jo_
  • 6,448
  • 1
  • 15
  • 12
0

Try the following. Assuming that you want to send your changes to origin master branch

git push

shek
  • 9
  • 1
  • 4