Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to execute git command: exit status 128 #3294

Closed
oleersoy opened this issue Jul 20, 2016 · 22 comments
Closed

Failed to execute git command: exit status 128 #3294

oleersoy opened this issue Jul 20, 2016 · 22 comments
Labels
🙇‍♂️ help wanted Need your help status: needs feedback Tell me more about it

Comments

@oleersoy
Copy link

I recently upgraded to the most recent docker build. Now when I clone and push to a new repository I get this when running git push:

No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
fatal: The remote end hung up unexpectedly 
Gogs: Internal error
Failed to execute git command: exit status 128

This is only when using the git protocol. If I use the http protocol I can clone and push, but when pushing I have to specify origin master like this git push origin master. I can't just write git push, which I think used to work before.

@oleersoy
Copy link
Author

I figured out the origin master part. My package manager updated git, and it wanted me to run this to get the old behavior back:
git config --global push.default matching

@unknwon
Copy link
Member

unknwon commented Jul 21, 2016

Please show gogs log as required.

@unknwon unknwon added the status: needs feedback Tell me more about it label Jul 21, 2016
@oleersoy
Copy link
Author

I created another test in order to provide the full sequence along with the corresponding log statements:

    ole@MKI:~/Sandbox$ git clone [email protected]:ole/test.git
    Cloning into 'test'...
    warning: You appear to have cloned an empty repository.
    Checking connectivity... done.

    ole@MKI:~/Sandbox$ cd test/

    ole@MKI:~/Sandbox/test$ touch RE.md

    ole@MKI:~/Sandbox/test$ git add .

    ole@MKI:~/Sandbox/test$ git commit -m "test"
    [master (root-commit) fcc8252] BS
     1 file changed, 0 insertions(+), 0 deletions(-)
     create mode 100644 RE.md

    ole@MKI:~/Sandbox/test$ git push 

    No refs in common and none specified; doing nothing.
    Perhaps you should specify a branch such as 'master'.
    fatal: The remote end hung up unexpectedly
    Gogs: Internal error
    Failed to execute git command: exit status 128
    error: failed to push some refs to '[email protected]:ole/test.git'

I then ran git push origin master it it worked OK:

Here's the part of the log that corresponds to the transaction:

    2016/07/21 14:27:50 [D] Session ID: 8718914a30f6ffa8
    2016/07/21 14:27:50 [D] CSRF Token: PtsKTStnPHcaYjne_WNW-_pe_LE6MTQ2OTExMTI2MDc2NzcwMDQ3Nw==
    2016/07/21 14:27:50 [D] Template: user/dashboard/dashboard
    [Macaron] Completed / 200 OK in 78.670108ms
    [Macaron] Started GET /repo/create for 203.0.113.254
    2016/07/21 14:27:54 [D] Session ID: 8718914a30f6ffa8
    2016/07/21 14:27:54 [D] CSRF Token: PtsKTStnPHcaYjne_WNW-_pe_LE6MTQ2OTExMTI2MDc2NzcwMDQ3Nw==
    2016/07/21 14:27:54 [D] Template: repo/create
    [Macaron] Completed /repo/create 200 OK in 27.956785ms
    [Macaron] Started POST /repo/create for 203.0.113.254
    2016/07/21 14:27:55 [D] Session ID: 8718914a30f6ffa8
    2016/07/21 14:27:55 [D] CSRF Token: PtsKTStnPHcaYjne_WNW-_pe_LE6MTQ2OTExMTI2MDc2NzcwMDQ3Nw==
    2016/07/21 14:27:56 [T] action.newRepoAction: ole/test
    2016/07/21 14:27:56 [T] Repository created[14]: ole/test
    [Macaron] Completed /repo/create 302 Found in 928.21959ms
    [Macaron] Started GET /ole/test for 203.0.113.254
    2016/07/21 14:27:56 [D] Session ID: 8718914a30f6ffa8
    2016/07/21 14:27:56 [D] CSRF Token: PtsKTStnPHcaYjne_WNW-_pe_LE6MTQ2OTExMTI2MDc2NzcwMDQ3Nw==
    2016/07/21 14:27:56 [D] Bare repository: /ole/test
    2016/07/21 14:27:56 [D] Template: repo/bare
    [Macaron] Completed /ole/test 200 OK in 77.387077ms
    Jul 21 14:28:51 sshd[171]: Accepted publickey for git from 203.0.113.254 port 32768 ssh2: RSA SHA256:3zAPBnFbpJCb7S9oK3g78p6wNEAMBFtPbxCi27mrT2w
    Jul 21 14:28:52 sshd[171]: Received disconnect from 203.0.113.254: 11: disconnected by user
    Jul 21 14:28:52 sshd[171]: Disconnected from 203.0.113.254
    Jul 21 14:29:14 sshd[182]: Accepted publickey for git from 203.0.113.254 port 32771 ssh2: RSA SHA256:3zAPBnFbpJCb7S9oK3g78p6wNEAMBFtPbxCi27mrT2w
    Jul 21 14:29:14 sshd[182]: Received disconnect from 203.0.113.254: 11: disconnected by user
    Jul 21 14:29:14 sshd[182]: Disconnected from 203.0.113.254
    Jul 21 14:31:32 sshd[193]: Accepted publickey for git from 203.0.113.254 port 32803 ssh2: RSA SHA256:3zAPBnFbpJCb7S9oK3g78p6wNEAMBFtPbxCi27mrT2w
    [Macaron] Started HEAD /ole/test/tasks/trigger?branch=master&secret=fb6b21fef28ba00f9d4fc898b7a0a363 for [::1]
    2016/07/21 14:31:33 [D] Session ID: ce69e20895df6a27
    2016/07/21 14:31:33 [D] CSRF Token: M8zEjX3x2xb4i8AVMhYybVHALPI6MTQ2OTExMTQ5MzcyNzQxODU2MA==
    2016/07/21 14:31:33 [T] TriggerTask [14].(new request): master
    [Macaron] Completed /ole/test/tasks/trigger?branch=master&secret=fb6b21fef28ba00f9d4fc898b7a0a363 202 Accepted in 58.990533ms
    2016/07/21 14:31:33 [T] DeliverHooks [14]: processing delivery hooks
    2016/07/21 14:31:33 [T] AddTestPullRequestTask[head_repo_id: 14, head_branch: master]: finding pull requests
    2016/07/21 14:31:33 [T] AddTestPullRequestTask[base_repo_id: 14, base_branch: master]: finding pull requests
    Jul 21 14:31:33 sshd[193]: Received disconnect from 203.0.113.254: 11: disconnected by user
    Jul 21 14:31:33 sshd[193]: Disconnected from 203.0.113.254

@unknwon
Copy link
Member

unknwon commented Jul 22, 2016

Please dump logs in log/serv.log file.

@oleersoy
Copy link
Author

This is the serv.log

    /data/gogs/log # cat serv.log 
    2016/07/16 03:50:59 [T] Trigger task: http://localhost:3000/ole/domain/tasks/trigger?branch=master&secret=188d2cd538f88e4e61d2b51cc49b567f
    2016/07/18 22:22:54 [...ts/gogs/cmd/serve.go:274 runServ()] [F] Failed to execute git command: exit status 128
    2016/07/20 16:51:17 [...ts/gogs/cmd/serve.go:274 runServ()] [F] Failed to execute git command: exit status 128
    2016/07/20 16:51:27 [...ts/gogs/cmd/serve.go:274 runServ()] [F] Failed to execute git command: exit status 128
    2016/07/20 16:52:44 [...ts/gogs/cmd/serve.go:274 runServ()] [F] Failed to execute git command: exit status 128
    2016/07/20 16:52:47 [...ts/gogs/cmd/serve.go:274 runServ()] [F] Failed to execute git command: exit status 128
    2016/07/21 14:29:14 [...ts/gogs/cmd/serve.go:274 runServ()] [F] Failed to execute git command: exit status 128
    2016/07/21 14:31:33 [T] Trigger task: http://localhost:3000/ole/test/tasks/trigger?branch=master&secret=fb6b21fef28ba00f9d4fc898b7a0a363

And just in case ...this is the gogs.log:

    /data/gogs/log # cat gogs.log
    2016/07/01 23:02:21 [I] New random avatar created: 4
    2016/07/06 00:32:52 [I] Log Mode: File(Info)
    2016/07/06 00:32:52 [I] Cache Service Enabled
    2016/07/06 00:32:52 [I] Session Service Enabled
    2016/07/06 00:32:52 [I] Git Version: 2.6.4
    2016/07/06 00:32:52 [I] SQLite3 Supported
    2016/07/06 00:32:52 [I] Run Mode: Production
    2016/07/06 00:32:52 [I] Listen: http://0.0.0.0:3000
    2016/07/08 22:19:55 [I] Log Mode: File(Info)
    2016/07/08 22:19:55 [I] Cache Service Enabled
    2016/07/08 22:19:55 [I] Session Service Enabled
    2016/07/08 22:19:55 [I] Git Version: 2.6.4
    2016/07/08 22:19:56 [I] SQLite3 Supported
    2016/07/08 22:19:56 [I] Run Mode: Production
    2016/07/08 22:19:56 [I] Listen: http://0.0.0.0:3000
    2016/07/12 02:11:33 [I] Log Mode: File(Info)
    2016/07/12 02:11:33 [I] Cache Service Enabled
    2016/07/12 02:11:33 [I] Session Service Enabled
    2016/07/12 02:11:33 [I] Git Version: 2.6.4
    2016/07/12 02:11:34 [I] SQLite3 Supported
    2016/07/12 02:11:34 [I] Run Mode: Production
    2016/07/12 02:11:35 [I] Listen: http://0.0.0.0:3000
    2016/07/17 05:10:32 [I] Log Mode: File(Info)
    2016/07/17 05:10:32 [I] Cache Service Enabled
    2016/07/17 05:10:32 [I] Session Service Enabled
    2016/07/17 05:10:32 [I] Git Version: 2.6.4
    2016/07/17 05:10:32 [I] SQLite3 Supported
    2016/07/17 05:10:32 [I] Run Mode: Production
    2016/07/17 05:10:32 [I] Listen: http://0.0.0.0:3000
    2016/07/17 20:05:46 [I] Log Mode: File(Info)
    2016/07/17 20:05:46 [I] Cache Service Enabled
    2016/07/17 20:05:46 [I] Session Service Enabled
    2016/07/17 20:05:46 [I] Git Version: 2.6.4
    2016/07/17 20:05:46 [I] SQLite3 Supported
    2016/07/17 20:05:46 [I] Run Mode: Production
    2016/07/17 20:05:47 [I] Listen: http://0.0.0.0:3000
    2016/07/18 21:28:04 [I] Log Mode: File(Info)
    2016/07/18 21:28:04 [I] Cache Service Enabled
    2016/07/18 21:28:04 [I] Session Service Enabled
    2016/07/18 21:28:04 [I] Git Version: 2.6.4
    2016/07/18 21:28:04 [I] SQLite3 Supported
    2016/07/18 21:28:04 [I] Run Mode: Production
    2016/07/18 21:28:05 [I] Listen: http://0.0.0.0:3000
    2016/07/20 16:52:47 [I] Log Mode: File(Info)
    2016/07/20 16:52:47 [I] Cache Service Enabled
    2016/07/20 16:52:47 [I] Session Service Enabled
    2016/07/20 16:52:47 [I] Git Version: 2.6.4
    2016/07/20 16:52:47 [I] SQLite3 Supported
    2016/07/20 16:52:47 [I] Run Mode: Production
    2016/07/20 16:52:47 [I] Listen: http://0.0.0.0:3000

@unknwon
Copy link
Member

unknwon commented Jul 22, 2016

Gogs version?

@oleersoy
Copy link
Author

0.8.42.0222

@oleersoy
Copy link
Author

I'm assuming that's the version. I got it from running docker logs gogs and this printed (See last line):

    ole@MKI:~/Sandbox$ docker logs gogs
    Jul 17 05:10:02 syslogd started: BusyBox v1.24.1
    Jul 17 05:10:02 sshd[27]: Server listening on :: port 22.
    Jul 17 05:10:02 sshd[27]: Server listening on 0.0.0.0 port 22.
    2016/07/17 05:10:32 [T] Custom path: /data/gogs
    2016/07/17 05:10:32 [T] Log path: /data/gogs/log
    2016/07/17 05:10:32 [I] Gogs Git Service 0.8.42.0222

@unknwon
Copy link
Member

unknwon commented Jul 22, 2016

Your Gogs version is far too old, please upgrade.

@oleersoy
Copy link
Author

Yup - I just realized that it did not pull the upgrade the first time I attempted it. I just did a fresh image pull and I still get this error:

      ole@MKI:~/Sandbox$ docker logs gogs
      Jul 22 17:13:34 syslogd started: BusyBox v1.24.2
      Jul 22 17:13:34 sshd[30]: Server listening on :: port 22.
      Jul 22 17:13:34 sshd[30]: Server listening on 0.0.0.0 port 22.
      2016/07/22 17:13:38 [T] Custom path: /data/gogs
      2016/07/22 17:13:38 [T] Log path: /data/gogs/log
      2016/07/22 17:13:38 [I] Gogs Git Service 0.9.48.0722
      2016/07/22 17:13:38 [I] Build Time: 2016-07-22 02:31:23 UTC
      2016/07/22 17:13:38 [I] Build Git Hash: 
      2016/07/22 17:13:38 [I] Log Mode: File(Info)
      2016/07/22 17:13:38 [I] Cache Service Enabled
      2016/07/22 17:13:38 [I] Session Service Enabled
      2016/07/22 17:13:38 [I] Git Version: 2.6.6
      2016/07/22 17:13:38 [I] Migration: convert date to unix timestamp
      2016/07/22 17:13:38 [I] This migration could take up to minutes, please be patient.
      2016/07/22 17:13:38 [I] Converting table: action
      2016/07/22 17:13:39 [T] Table [action]: offset: 0, beans: 65

      ole@MKI:~/Sandbox$ git clone [email protected]:ole/ole.git
      Cloning into 'ole'...
      warning: You appear to have cloned an empty repository.
      Checking connectivity... done.

      ole@MKI:~/Sandbox$ cd ole/

      ole@MKI:~/Sandbox/ole$ touch README.md

      ole@MKI:~/Sandbox/ole$ git add README.md 

      ole@MKI:~/Sandbox/ole$ git commit -m commmit
      [master (root-commit) f168546] commmit
       1 file changed, 0 insertions(+), 0 deletions(-)
       create mode 100644 README.md

      ole@MKI:~/Sandbox/ole$ git push
      No refs in common and none specified; doing nothing.
      Perhaps you should specify a branch such as 'master'.
      fatal: The remote end hung up unexpectedly
      Gogs: Internal error
      Failed to execute git command: exit status 128
      error: failed to push some refs to '[email protected]:ole/ole.git'

@unknwon
Copy link
Member

unknwon commented Jul 22, 2016

You can only go git push/pull after web UI is available to visit, from the log does not seem so, the migration is not finished.

@oleersoy
Copy link
Author

Yes it did finish. I created the repository ole after the server was back up.

@unknwon
Copy link
Member

unknwon commented Jul 22, 2016

I guess it might be problem with volumed directory. cc @0rax

@oleersoy
Copy link
Author

It seems like it's a protocol issue. If I do git push origin master it works. I just repeated both tests to make sure. This is the git push origin master test.

      ole@MKI:~/Sandbox/ole$ git push origin master
      Counting objects: 3, done.
      Writing objects: 100% (3/3), 202 bytes | 0 bytes/s, done.
      Total 3 (delta 0), reused 0 (delta 0)
      To [email protected]:ole/ole.git
       * [new branch]      master -> master

@unknwon unknwon added the 🙇‍♂️ help wanted Need your help label Jul 23, 2016
@0rax
Copy link
Contributor

0rax commented Jul 23, 2016

Hi there, I have multiple question for you as I am not able to reproduce even the clone via 'git@realm:orax/repo'.

Using just this url will ask me for a password, using ssh://git@realm:orax/repo will work as expected (incuding git push).

Via https everything is also working as expected.

What is your local git version as well as your gogs version. What url are you given by Gogs when running it ? In the current version you only have an HTTP / HTTPS one and a SSH one (no old school git@... without any prefix).

I am really wondering how it is registered in your side via git / why you are able to clone without specifying the ssh:// protocol by default.

Can you give us the output of git remote show origin [with any url redacted if you wish] ?

Also can you check your ~/.gitconfig for any weird option ?

Thanks :)

@oleersoy
Copy link
Author

Hi Jean,

ole@MKI:~/Sandbox$ git --version
git version 1.9.1

Gogs version from logs:

2016/07/22 17:13:38 [I] Gogs Git Service 0.9.48.0722

Git config:

ole@MKI:~/Sandbox$ git config --list
[email protected]
user.name=Ole Ersoy
credential.helper=cache
push.default=matching

So now I'll visit my gogs URL (203.0.113.1:3000) and create a repo:

[email protected]:ole/gogstest.git

Then clone it, etc:

    ole@MKI:~/Sandbox$ git clone [email protected]:ole/gogstest.git
    Cloning into 'gogstest'...
    warning: You appear to have cloned an empty repository.
    Checking connectivity... done.

    ole@MKI:~/Sandbox$ cd gogstest/

    ole@MKI:~/Sandbox/gogstest$ touch README.md

    ole@MKI:~/Sandbox/gogstest$ git add README.md 

    ole@MKI:~/Sandbox/gogstest$ git commit -m "Test"
    [master (root-commit) 26232e6] Test
     1 file changed, 0 insertions(+), 0 deletions(-)
     create mode 100644 README.md

FAILURE:

    ole@MKI:~/Sandbox/gogstest$ git push
    No refs in common and none specified; doing nothing.
    Perhaps you should specify a branch such as 'master'.
    fatal: The remote end hung up unexpectedly
    Gogs: Internal error
    Failed to execute git command: exit status 128
    error: failed to push some refs to '[email protected]:ole/gogstest.git'

SUCCESS:

    ole@MKI:~/Sandbox/gogstest$ git push origin master
    Counting objects: 3, done.
    Writing objects: 100% (3/3), 212 bytes | 0 bytes/s, done.
    Total 3 (delta 0), reused 0 (delta 0)
    To [email protected]:ole/gogstest.git
     * [new branch]      master -> master

@0rax
Copy link
Contributor

0rax commented Jul 23, 2016

Thanks that's perfect, I will try to reproduce this with those exact version & git configuration !

Will keep you informed here !

@oleersoy
Copy link
Author

oleersoy commented Jul 23, 2016

Cool thanks - let me know if you need anything else 👍 I am using an SSH key which I'm sure you already guessed.

@0rax
Copy link
Contributor

0rax commented Jul 24, 2016

Just run this test in a ubuntu:14.04 container and on my Mac. Which contains the same version of git as you.

Note that I have my ssh port set to 2222 on my instance of Gogs, thus requiring me to create an ssh_config telling git & ssh to use port 2222 by default as the syntax you are using to clone does not accept a port.

An alternative scp-like syntax may also be used with the ssh protocol:

o   [user@]host.xz:path/to/repo.git/

This syntax is only recognized if there are no slashes before the first colon. This helps
differentiate a local path that contains a colon. For example the local path foo:bar could be
specified as an absolute path or ./foo:bar to avoid being misinterpreted as an ssh url.

Ubuntu 14.04

$ docker run -it --rm ubuntu:14.04 bash
# apt-get update && apt-get install git
...
# git version
git version 1.9.1
# git config --global user.email        [email protected]
# git config --global user.name         "0rax"
# git config --global credential.helper cache
# git config --global push.default      matching
# ssh-keygen -t rsa -f ~/.ssh/id_rsa -N ''
Generating public/private rsa key pair.
Created directory '/root/.ssh'.
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
...
# cat ~/.ssh/id_rsa.pub
ssh-rsa ...
# # Force use of the correct port to be able to reproduce the problem
# echo -e "Host gogs.my.fqdn\n\tport 2222" >> ~/.ssh/config
# git clone [email protected]:/orax/test-repo.git
Cloning into 'test-repo'...
warning: You appear to have cloned an empty repository.
Checking connectivity... done.
# cd test-repo
# echo '# Test-Repo' >> README.md
# git add README.md; git commit -m 'README'
# git push
No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
fatal: The remote end hung up unexpectedly
Gogs: Internal error
Failed to execute git command: exit status 128
error: failed to push some refs to '[email protected]:/orax/test-repo.git'
# git remote show origin
* remote origin
  Fetch URL: [email protected]:/orax/test-repo.git
  Push  URL: [email protected]:/orax/test-repo.git
  HEAD branch: (unknown)
  Local branch configured for 'git pull':
    master merges with remote master

OSX

$ git config --global push.default matching
$ git version
git version 2.9.0
$ echo -e "Host gogs.my.fqdn\n\tport 2222" >> ~/.ssh/config
$ git clone [email protected]:/orax/test-repo.git /tmp/test-repo
Cloning into '/tmp/test-repo'...
warning: You appear to have cloned an empty repository.
Checking connectivity... done.
$ cd /tmp/test-repo
$ echo '# Test-Repo' >> README.md
$ git add README.md; git commit -m 'README'
[master (root-commit) 0a666c2] README
 1 file changed, 1 insertion(+)
 create mode 100644 README.md
$ git push
No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
fatal: The remote end hung up unexpectedly
Gogs: Internal error
Failed to execute git command: exit status 128
error: failed to push some refs to '[email protected]:/orax/test-repo.git'
$ git config --global push.default current
$ git push
Counting objects: 3, done.
Writing objects: 100% (3/3), 229 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To [email protected]:/orax/test-repo.git
 * [new branch]      master -> master

Conclusion

This problem seems to happen with the push.default=matching option only. With my own configuration (push.default=current) it works as expected. I will try to see exactly why this specific git-config option seems to break the intended behaviour. I will try to gather more information about this problem (and see if other git hosting solution suffers from it) but it seems to be due to this old default option for push.default more that anything else.


EDIT: I stand corrected, this also happen with the standard ssh:// syntax and thus this problem is just due to the push.default=matching option.

@oleersoy
Copy link
Author

Sorry for the delayed response. Great work BTW. Definitely hit the bullseye. I tested this out with the latest container and the push.default option removed, and now it works fine. I'll just close this.

@olafure
Copy link

olafure commented Aug 1, 2016

This is still a bug in gogs_v0.9.48_linux_amd64.tar.gz
Reproduce:
Install the version specified above.
git config --global push.default=matching
Create a user/repo, add key
Clone repo
echo 123>file && git add . && git commit -m "commit" && git push

$ git push
No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
fatal: The remote end hung up unexpectedly
Gogs: Internal error
Failed to execute git command: exit status 128
error: failed to push some refs to 'user@host:repo/10.git'

@0rax
Copy link
Contributor

0rax commented Aug 1, 2016

@olafure: so this is also happening on non Docker distribution right ?

I might have expected that but wasn't sure as I did not have any time to setup a barebone gogs instances.

@0rax 0rax reopened this Aug 1, 2016
@unknwon unknwon closed this as completed Aug 11, 2016
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🙇‍♂️ help wanted Need your help status: needs feedback Tell me more about it
Projects
None yet
Development

No branches or pull requests

4 participants