SourceTree and GitHub: unable to pull / push after reseting to a previous commit - github

I messed my repository while trying to resolve conflicts. Everything was quite OK (I'm getting familiar with Git) but things got bad when I tried to reset the current branch to a previous commit (not knowing exactly what I was doing, I admit). In SourceTree, I now have 2 commits to Pull from GitHub and 10 commits to Push. When I tried to Pull, I got this:
git -c diff.mnemonicprefix=false -c core.quotepath=false fetch origin
git -c diff.mnemonicprefix=false -c core.quotepath=false pull --no-commit origin master
From https://github.com/JnLlnd/CSVBuddy
* branch master -> FETCH_HEAD
error: The following untracked working tree files would be overwritten by merge:
TEST-TheBeatles-Tab (1).txt
TEST-TheBeatles-Tab-EXPORT (1).txt
TEST-TheBeatles-Tab-EXPORT.txt
html-doc/img/review2_5_CSV Buddy_award.png
icon/csvbuddy-16x16.png
icon/csvbuddy-32x32.png
Please move or remove them before you can merge.
Aborting
I moved the 6 files and tried to Pull again. It seems to work (no error message). However, I still have the indication that there are 2 Pull to do.
If I try to Push the 10 commits, I get this error message:
git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags origin master:master
Pushing to https://github.com/JnLlnd/CSVBuddy
To https://github.com/JnLlnd/CSVBuddy
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/JnLlnd/CSVBuddy'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Hum... I think I'm not that familiar with Git ;-) What should I do?

OK. Think I got it. I still had 2 conflicts to resolve before I can Pull / Push as desired.
Thanks for reading.

Related

failed to push some refs to 'https://github.com/<username>/my-history.git'

I can't update the source code in the repository on github.com using the following command.
$ git push -u origin master
The following error is displayed:
! \[rejected\] master -\> master (fetch first)
error: failed to push some refs to 'https://github.com/\<username\>/my-history.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Is there any way to do this?
I want to push the source code in the my repository.
I experienced something similar to this a few days ago.
You can do something like this:
$ git remote add origin https://github.com/username/my-repo.git
$ git push -f origin master

Pushing commit to github repository throwing error

The error I am getting:
To https://github.com/Git-Username/Repo.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/user/repo.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Command I am executing:
git push origin master
I have tried nearly everything when I googled this error, I tried pulling etc.
I tried pulling etc.
pulling should have been enough to solve the issue.
But if your local history is correct (git log), and you are the only one pushig to that repository, you could also simply force push
git push --force -u origin master
That will override the history on the remote.

Bitbucket and Git same time push error

Early I had only github repository, but now want used both github and bitbucket.
I added a new remote git repository on Bitbucket, use git remote set-url.
git remote -v show
origin https://github.com/My/remont (fetch)
origin https://github.com/My/remont (push)
origin https://my#bitbucket.org/my/remont.git (push)
Then run:
git add --all .
git commit -m "bitbucker"
git push -u origin master
Github added fine but bitbucket shows an error
Password for 'https://my#bitbucket.org':
To https://bitbucket.org/my/remont.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://my#bitbucket.org/my/remont.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

Push a local file to an existing GitHub remote repo

Trying to push a committed file to an existing remote repository on GitHub.
Below I verified and I'm trying to push to the Django. I've tried git push, and git push -u Django master. Any help would be appreciated. I have been saving all of my files locally and I am now adding all to GitHub and it's a little confusing.
Roberts-MBP:Django robertamato$ git remote -v
Django https://github.com/CodingDojo-Python-09-04/Robert_Amato.git (fetch)
Django https://github.com/CodingDojo-Python-09-04/Robert_Amato.git (push)
origin https://github.com/CodingDojo-Python-09-04/RobertAmato (fetch)
origin https://github.com/CodingDojo-Python-09-04/RobertAmato (push)
Roberts-MBP:Django robertamato$
Here is a error code it threw, I see it suggests to fetch first but I'm not to familiar with how that process works.
Roberts-MBP:Django robertamato$ git push -u Django master
To https://github.com/CodingDojo-Python-09-04/Robert_Amato.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/CodingDojo-Python-09-04/Robert_Amato.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.

Ionic 2 and github

I have committed a tabs app project to a classroom repo set up by our lecturer.
I changed my mind then and want to start with a blank app.
Now I seem to have two master branches and need to delete the first.
The push triggers the following error message:
error-- ! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/xxxxxxxxx/2nd-year-software-ionic-2-assignment-xxxxxxxx.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
How can I get past that error message?
All you need to do is force the push:
git push --force -u origin master
That will replace the history of the remote master by the one you have locally.