• Register
0 votes

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 = https://username@github.com/username/repository.git 
    [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 shown in 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 git@github.com:username/repository.git, then I face different error and it is as below :

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

Does anyone have any solution for my issues?

by (7.5k points)  

1 Answer

0 votes

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.

by (36.1k points)