Archive for May, 2014

git extensions–syntax error near unexpected token

gitExtensions  GitExtensions is a GUI, Visual Studio plugin and shell extensions for Git.

Problem :

Whenever you use newly installed GitExtensions to pull ne repo from remote repo you may face below error.

Syntax error near unexpected token ‘(‘

Below is full error log :

"C:\Program Files (x86)\Git\bin\git.exe" push --recurse-submodules=check 
--progress "origin" refs/heads/master:refs/heads/master
\"C:/Program Files (x86)/GitExtensions/GitCredentialWinStore/git-credential-winstore.exe\" 
get: -c: line 0: syntax error near unexpected token `('
\"C:/Program Files (x86)/GitExtensions/GitCredentialWinStore/git-credential-winstore.exe\" 
get: -c: line 0: `\"C:/Program Files (x86)/GitExtensions/GitCredentialWinStore/git-credential-winstore.exe\" get'
\"C:/Program Files (x86)/GitExtensions/GitCredentialWinStore/git-credential-winstore.exe\" 
erase: -c: line 0: syntax error near unexpected token `('
\"C:/Program Files (x86)/GitExtensions/GitCredentialWinStore/git-credential-winstore.exe\" 
erase: -c: line 0: `\"C:/Program Files (x86)/GitExtensions/GitCredentialWinStore/git-credential-winstore.exe\" erase'
fatal: Authentication failed for 'https://<username><username>/<repo>.git/'

Solution :
The problem is syntax error in default gitconfig file. You can find default config file in C:\Users\<UserName>\gitconfig
Try to find entry below for [credential] section. It looks like below 

     helper = !\\\”C:/Program Files (x86)/GitExtensions/GitCredentialWinStore/git-credential-winstore.exe\\\”

Notice the 3 slashes after ! in the start of entry and 3 slashes at the end of the entry. Remove two unnecessary slashes so it will look like this :

     helper = !\”C:/Program Files (x86)/GitExtensions/GitCredentialWinStore/git-credential-winstore.exe\”

Go and run your command again, it should work.


git–push large commits over http fail

Problem : When you try to commit a large size file or trying to commit huge amount of data in single commit you may face this issue. This issue can also be encountered when you are trying to move your source control from other tools like VFS, SVN to git as you will have to move your existing source files in huge commits. Normally you are greeted with below error codes :

fatal: The remote end hung up unexpectedly error: RPC failed; result=22, HTTP code = 413

$ git push origin master
Username for '<HOST>: <USER_EMAIL>
Password for 'http://<USER_EMAIL>@<HOST>':
Counting objects: 3322, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3010/3010), done.
Writing objects: 100% (3322/3322), 29.87 MiB | 8.07 MiB/s, done.
Total 3322 (delta 2379), reused 371 (delta 249)
error: RPC failed; result=22, HTTP code = 413
fatal: The remote end hung up unexpectedly
fatal: recursion detected in die handler
Everything up-to-date

Solutions : Try below solutions as the problem can be caused by several factors :

1)  Change protocol from http(s) to git/ssh

Try to move your repo’s remote connection url from http(s) to git/ssh. You can add remote for your repository using add remote command.$ git remote add origin [email protected]:username/project.git

2) Increase git http post buffer size

The next place to look is git http buffer size settings. To increase git http post buffer size 
you can use below command in your git command prompt
git config http.postBuffer 524288000

3) Increase server (nginx) buffer size

If above does not work than you should be now looking at web server buffer size. git over http will use some kind of web server to process http requests. For example in GitLab it will be nginx by default. To increase buffer size in nginx you need to change the config parameter client_max_body_sizeAdd it to /etc/nginx/sites-available/gitlab on ( in Ubuntu ). In CentOS it be should in /etc/nginx/nginx.conf.

http {
    # ...
    client_max_body_size 16M;
    ...#  }

Change client_max_body_size to whatever you want.