Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what does return code 32768 mean in "git clone"

I am having a program continuously downloading projects from GitHub and then processing them. Then I found every now and then my program stuck in the GitHub prompt for typing user account and password.

My exploration about GitHub shows that these projects are no longer valid and that if I add my account and password in to "git clone" (e.g., https://user_name:[email protected]/dev/proj.git) I can avoid the password prompt and get a return code 32768.

Thus I use 32768 as a way to distinguish successfully downloads and failed downloads. But it turned out that the "git clone" of many valid GitHub projects also return "32768" as the status code.

So I am likely to have misunderstood "32768". My first problem is what "32768" means as a return code of "git clone".

I need to make the program run without supervision. My second question is how to make my program figure out the "git clone" finishes successfully without typing user account and password.

------add ---- Find some debugging, I found that the return code of git clone command in Linux terminal is 128. I ran the command using os.system(cmd_git_clone), the return code of os.system is 32768.

like image 960
Peipei Avatar asked Feb 11 '26 06:02

Peipei


2 Answers

I think this is feasible as number of steps. First, configure git not to prompt for a password (so that your program doesn't get stuck):

GIT_TERMINAL_PROMPT=0 git clone <repository>

Then check the return code of the command, and if it is valid, clone worked:

retVal=$?
if [ ! $? -eq 0 ]; then
    echo "Error"
else
    echo "Success"
fi
exit $retVal
like image 137
Derek Brown Avatar answered Feb 14 '26 14:02

Derek Brown


so I've just run into the same status code and had been puzzled for hours.

Turns out, for me, after debugging and reading the stderror messages, it turns out Git was complaining about not knowing who I am (See: Git: "please tell me who you are" error). I added a few lines in my program to configure my name and email in git, and everything was fine.

This seems to be quite a common error when you have scripts that do your job.

like image 28
Winston Du Avatar answered Feb 14 '26 15:02

Winston Du