Git push origin master returns Error cannot spawn ... why?
Asked Answered
S

6

11

I'm trying to use GitHub for the first time, but after many issues trying to get the authentication right, I've managed to authenticate with [email protected] and created a repo, but when i try "git push origin master" i get the following error:

$ git push origin master
error: cannot spawn : No such file or directory
fatal: unable to fork

I cant find any reason for the error or any explanation in the trouble shooting pages, can anyone suggest why it may be that I get that error.

I have already specified/added the remote path as follows:

$ git remote add origin [email protected]:christopherdebeer/yUML-Diagram.git

please help.

Also this is all on a windows 7 machine running mysysgit (1.7.0.2) and using git bash.

re: Issue 313, a space in the GIT_SSH variable, cant be the problem mine is as follows:

$GIT_SSH="c:/putty/plink.exe"
Shipmate answered 22/6, 2010 at 22:14 Comment(0)
S
2

I'm not sure if it was just stupid of myself, but I've solved the problem... Here's what I did (from advice, from work colleagues):

I was attempting to push changes in a local repo to an empty repo on github...

what i should have done was clone the empty repo, add the files locally to my cloned repo, added the files, commited the adds, and THEN push to the github repo...

$ git clone [email protected]:christopherdebeer/yUML-Diagram.git
 // added files
$ git add *
$ git commit -m "first commit locally"
$ git push origin master

My original problems might have been due to my totaly naivety as to gits usage...

Shipmate answered 26/6, 2010 at 19:16 Comment(4)
Strange, since you shouldn't be able to clone an empty repo: #1298690 and #896319. See also support.github.com/discussions/repos/…Entrain
The advice that i recieved from a work colleague, (he doesnt use git at all, but does svn) ... when i mentioned my issues he recommended cloning the empty repo... as though it were common practice (if not for svn) then for him at least.Shipmate
which is weird that you say it isnt possible... because it Definitly worked for me.Shipmate
@VonC: Git 1.6.2 and later can “clone” empty repositories (i.e. setup the remote and a local master branch that will, eventually, track the remote master branch).Smother
E
4

That reminds me of issue 313, where GIT_SSH environment variable contains spaces in its path.

Other than that, did you followed the GitHub Help page and checking if your ssh connection worked?

$ ssh [email protected]
The authenticity of host 'github.com (207.97.227.239)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,207.97.227.239' (RSA) to the list of known hosts.
ERROR: Hi tekkub! You've successfully authenticated, but GitHub does not provide shell access
Connection to github.com closed.
Entrain answered 22/6, 2010 at 23:21 Comment(5)
Yeah ive definitely checked that my ssh works correctly. as per the GitHub help page, and gotten the mesage: "Hi christopherdebeer! You've successfully authenticated but GitHub does not provide shell access" I'll look into "issue 313"...Shipmate
Nope its is definitly not issue 313, my $GIT_SSH is set to "c:/putty/plink.exe"Shipmate
@Christopher: How about not using GIT_SSH and plink.exe at all? I don't (on my Windows7 msysgit installation) and push just fine. What version of msysgit are you using by the way?Entrain
@Entrain I'll give it a go, I'm using 1.7.0.2 mysysgitShipmate
@Christopher: Then could you try changing the remote address from a git protocol to an https protocol, taking advantage from the smart http implementation proposed by GitHub? See https://mcmap.net/q/394238/-push-to-github-error-couldn-39-t-find-host-github-com-in-the-netrc-file-using-defaults/…Entrain
S
2

I'm not sure if it was just stupid of myself, but I've solved the problem... Here's what I did (from advice, from work colleagues):

I was attempting to push changes in a local repo to an empty repo on github...

what i should have done was clone the empty repo, add the files locally to my cloned repo, added the files, commited the adds, and THEN push to the github repo...

$ git clone [email protected]:christopherdebeer/yUML-Diagram.git
 // added files
$ git add *
$ git commit -m "first commit locally"
$ git push origin master

My original problems might have been due to my totaly naivety as to gits usage...

Shipmate answered 26/6, 2010 at 19:16 Comment(4)
Strange, since you shouldn't be able to clone an empty repo: #1298690 and #896319. See also support.github.com/discussions/repos/…Entrain
The advice that i recieved from a work colleague, (he doesnt use git at all, but does svn) ... when i mentioned my issues he recommended cloning the empty repo... as though it were common practice (if not for svn) then for him at least.Shipmate
which is weird that you say it isnt possible... because it Definitly worked for me.Shipmate
@VonC: Git 1.6.2 and later can “clone” empty repositories (i.e. setup the remote and a local master branch that will, eventually, track the remote master branch).Smother
M
1

I'm not sure if this is only a smartgit issue, but when this happens in that program its actually a permissions issue on the temp folder. It seems like windows 7 and 8 occasionally reset the permissions on the temp directory and you need to change them back to full read and write perms.

Maddalena answered 4/6, 2013 at 18:39 Comment(0)
M
0

I had same problem. I changed my remote link from:

[email protected]:Prathapnagaraj/trydjango18.git

to url-link:

https://github.com/Prathapnagaraj/trydjango18

then it worked fine.

Methodical answered 29/3, 2017 at 7:4 Comment(1)
This is far from optimal if you primarily use SSH.Automate
M
0

Do a pull first, before pushing. It seems that sometimes your local repo gets "stale". When I don't push or pull anything for a week or so, I need to pull (even though there are no changes, since I'm the only one working on that repo).

Medeiros answered 6/2, 2019 at 11:51 Comment(0)
P
0

I had the same issue. Some debugging steps that I tried:

  • ssh -T [email protected] works fine
  • GIT_SSH is empty, just like on another machine where the command works fine
  • gitconfig's sshCommand doesn't matter at this point; the error occurs before that is read
  • I can't use/try the https remote url, as it's disabled remotely
  • git remote remove origin && git remote add origin git@<repository> didn't resolve the issue
  • In fact, another repository on the same machine can pull just fine, indicating this issue is within the local .git folder

I pushed all my branches with local state, backed up some untracked files, deleted the whole repository directory and cloned again. From then on everything worked as it should 😊

My best guess as the what was going on is corruption somewhere in the .git folder.

Pitchford answered 16/1, 2023 at 11:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.