Problem :

I am working on the project remotely through the command line on the machine to which I don't have the admin rights and after running git push origin master I get the below error message:

*(gnome-ssh-askpass:29241): Gtk-WARNING *: cannot open display:

My .git/config file has the below contents:

           repositoryformatversion = 0
           filemode = true
           bare = false
           logallrefupdates = true 
        [remote "origin"]
           fetch = +refs/heads/*:refs/remotes/origin/*
           url = 
        [branch "master"]
           remote = origin
           merge = refs/heads/master

Initially, I was getting the 403 error. When I put the username before the @ sign in the remote URL is shown in the above file and since then, I am facing the Gtk error.

Whenever I try to login to the machine using ssh -X and try to push, I often face the below error:

X11 connection rejected because of wrong authentication.
(gnome-ssh-askpass:31922): Gtk-WARNING **: cannot open display:localhost:10.0

If I try to change the url of the remote box to, then I face a different error and it is as below :

ssh: connect to host port 22: Connection timed out
fatal: The remote end hung up unexpectedly

Does anyone have any solution for my issues?

Solution :
I have finally discovered the solution to your problem. I ran the below command in the terminal:


and after that ran the git push origin master and it works the way it should. You should also add the above-given line to your .bashrc file

More Posts

Fatal: could not read username for '': no such device or address Alecxe01 - Nov 14
Introduction to Git sanchi - Apr 30
What is the git command to see all changes since the last commit? sanchi - Apr 29
What is the difference between git and github Sanjana Sagar - May 29
Error: src refspec master does not match any. error: failed to push some refs to Alecxe01 - Oct 31
Fatal: could not read username for '': terminal prompts disabled Alecxe01 - Nov 14
No matching key exchange method found. their offer: diffie-hellman-group1-sha1 Alecxe01 - Nov 15
Error: the following untracked working tree files would be overwritten by merge Alecxe01 - Nov 15
How to deploy your website to github chrissiemhrk - Jun 29
Error response from daemon: driver failed programming external connectivity on endpoint Alecxe01 - 4 days