简体   繁体   中英

Entirely new git repo says “Everything up-to-date” when trying to push to entirely new remote

I am a git newbie. I just created a new project with just 4 new files test1 test2 test3 test4. Then all I did are the following:

$ git init
$ git add .
$ git commit -m "VERY 1st commit"

as simple as that.

then i added a remote repo is also an entirely new repo i just created in bitbucket.org

$ git remote add rakspace http://syedrakib@bitbucket.org/syedrakib/mysamplegit
$ git push rakspace

as you can tell it's entirely new workspace being pushed into an entirely new repo. it returns this:

Everything up-to-date

what is it i am doing wrong here? Clearly the source files of the remote repo are NOT getting updated.

EDIT: I have got 2 branches in my local repo: *master* and *new_branch*

The default behavior of git push is to push "matching" branches. That means any branches on your side that have a branch named the same thing on the other side get pushed. In a brand new repository, there are no branches. Therefore no branches match. You can cause a branch with a name matching your branch to be created on the remote using git push <remote name> <branch name> . In your case: git push rakspace master

You can find out about and change the push settings by looking for push.default in the git config documentation .

Try doing git push rakspace master . Think you need to specify which branch you want to push.

If that's not the problem then, I'm wondering if you actually added anything to the repository by doing git add . ?

Try doing

touch TEST
git add .
git commit -m "Committing a file named TEST."
git push rakspace master

After tonnes of discussions in multiple places all over the web, i figure the solution for first time push to a clean new repo is

git push rakspace --all

From then on, the push-pull are working like normal. HOW FUNNY??!!!

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