-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
  • 27,717
  • 28
  • 128
  • 190
Prithviraj Mitra
  • 11,002
  • 13
  • 58
  • 99

5 Answers5

3

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
  • 837
  • 12
  • 31
2

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
  • 326
  • 1
  • 20
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,293
  • 1
  • 10
  • 24
Sumanth Madishetty
  • 3,425
  • 2
  • 12
  • 24
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_
  • 8,324
  • 1
  • 18
  • 14
0

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

git push

shek
  • 7
  • 1
  • 4