Sourcetree Won't Push Commit!

My Sourcetree is not pushing to Github! When I hit push it says:

Any help is very much appreciated.

Please help, this is still a big issue for me.

As the hint indicates, try pulling first from the remote repo. Once merged, you should be able to push your changes.

I’m sorry, I haven’t used Github prior to this course. What’s the remote repo?

Simply click the “Pull” button in Sourcetree and once that completes, you can click “Push” button. Perhaps you’ve edited some file in github which created a commit that you now need to fetch on your local repository using your git client (sourcetree)

1 Like

It says this:

git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags origin master:master
fatal: HttpRequestException encountered.
An error occurred while sending the request.

POST git-receive-pack (chunked)

That’s still the output of a git push. What it seems to be telling you is that there are changes that are checked into github that you don’t have in your local copy. This may be something as simple as you changing the description of your project on its main page, as this is stored in a file called README.md. Did you try clicking on ‘Pull’ in sourcetree as @martin-holkovic said? If so, and it’s still not working, can you post the output from that?

Changing the readme changed the origin/master and origin/head, but I still can’t push. I have tried pressing the “Pull” button, and that text I showed above is the output of me trying to push after it successfully pulls. Still getting that error.

PC or Mac?

The issue you’re having now is most likely happening because you’re using HTTPS with git instead of SSH for a very large project. If you’re on a Mac, it’s really easy to switch to SSH. If you’re on PC it’s a little more involved, but still possible. There are some good instructions here on how to setup SSH. The only difference from those instructions is that you would upload your SSH public key to github instead of bitbucket. I would recommend that anyone who intends to use git with any regularity setup SSH.

Sorry for the delay. I’ll give it a try. BTW I’m on a PC.

After setting up the SSh it says this…

That screenshot still shows an HTTP error, so it’s not using SSH. Even after setting up SSH, if you don’t update the URL of your repo it’ll still use HTTP. You need to change the remote address of your repo to git@github.com:CamoSnipe200/04_BattleTank.git

Unfortunately I don’t know the process in Source Tree as I do all of my git operations from the command line, but if you’re comfortable in cmd/git-bash you can go to the directory of your project and run this command: git remote set-url origin git@github.com:CamoSnipe200/04_BattleTank.git

So I did what you said and got somewhere. But now it says this: Capture27

After I click ‘yes’ it says this: Capture29

Once I click ready, it goes back to the first image, even though I added the key in Pageant.

Two things:

  • First, click the pageant icon in your system tray and select View Keys Make sure the SSH key you created is loaded in the agent. If it’s not there, select Add Key And load in the key.

  • Second, double check GitHub to make sure the SSH public key is properly uploaded to your account.

This is what may Pageant looks like: Capture30
I think that the key is private, as it won’t let me upload the public one though. Is that a problem?

How do you do that? I am not adept at GitHub, so more detail would be appreciated. BTW I am using SourceTree.

Sorry for the delay. Tis the seaons…

In your command line, type the following

cd %USERPROFILE%/.ssh

then

type id_rsa.pub (and yes I mean type the word ‘type’)

This should print out the value of your public key to the command line. Highlight the full value, starting with ssh-rsa and copy it. Then go to github. Once you’re logged in, click your user icon in the top right and go to the settings page. On the left side, one of the options is SSH and GPG Keys Select that, and in the subsequent page, cick New SSH Key Give it whatever title you want, and paste in the value of your public key from the command line into the Key box. Once you save that, you should be good.

how change SSH in github ?
… i use Sorucetree as well

Privacy & Terms