Can not push on Windows2012 data center #2990

Closed
opened 2025-11-02 04:56:19 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @FalconWu2017 on GitHub (Feb 28, 2019).

  • Gitea version (or commit ref):1.7.3
  • Git version:git version 2.20.1.windows.1
  • Operating system:Windows2012 data center
  • Database (use [x]):
    • [X ] SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    It is only not right work at the server.
  • Log gist:

2019/02/28 10:35:02 [D] Session ID: 0e9e898aa761d6da
2019/02/28 10:35:02 [D] CSRF Token: z07JrXhNLNYM-NuEZSTCrwaRSQw6MTU1MTMyMTMwMjM2MDExNDMwMA==
2019/02/28 10:35:02 [D] Session ID: 89a92b3951ee5163
2019/02/28 10:35:02 [D] CSRF Token: 3mUfhOLrUTnUqurZIbE_JZ32fQA6MTU1MTMyMTMwMjgxMzIzMzAwMA==
2019/02/28 10:35:03 [D] Session ID: 6a47aeecb3fd0b78
2019/02/28 10:35:03 [D] CSRF Token: MAaxMN5WrbJWxJ1NG1IZv8A5U_g6MTU1MTMyMTMwMzQ4NTAwMjYwMA==

Description

The default hook files pre-receive,update and post-receive will be generated with a new repository generated. At the 1st line of all these three files are "#!/usr/bin/env bash".but I can not push any commits form client to the service with these default hook files.Git bash show me a error in client:

$ git push
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 4 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 281 bytes | 281.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To http://XXX.XXX.XXX.XXX/ORG/CantPush.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'http://XXX.XXX.XXX.XXX/ORG/CantPush.git'

If I change the 1st line of these three hook files to #!/bin/bash, push will be OK,At least looks good.
So I have to edit every hook file for every new repository and I am not sure if it works properly.

Originally created by @FalconWu2017 on GitHub (Feb 28, 2019). - Gitea version (or commit ref):1.7.3 - Git version:git version 2.20.1.windows.1 - Operating system:Windows2012 data center - Database (use `[x]`): - [X ] SQLite - Can you reproduce the bug at https://try.gitea.io: It is only not right work at the server. - Log gist: 2019/02/28 10:35:02 [D] Session ID: 0e9e898aa761d6da 2019/02/28 10:35:02 [D] CSRF Token: z07JrXhNLNYM-NuEZSTCrwaRSQw6MTU1MTMyMTMwMjM2MDExNDMwMA== 2019/02/28 10:35:02 [D] Session ID: 89a92b3951ee5163 2019/02/28 10:35:02 [D] CSRF Token: 3mUfhOLrUTnUqurZIbE_JZ32fQA6MTU1MTMyMTMwMjgxMzIzMzAwMA== 2019/02/28 10:35:03 [D] Session ID: 6a47aeecb3fd0b78 2019/02/28 10:35:03 [D] CSRF Token: MAaxMN5WrbJWxJ1NG1IZv8A5U_g6MTU1MTMyMTMwMzQ4NTAwMjYwMA== ## Description The default hook files `pre-receive`,`update` and `post-receive` will be generated with a new repository generated. At the 1st line of all these three files are "#!/usr/bin/env bash".but I can not push any commits form client to the service with these default hook files.Git bash show me a error in client: ``` $ git push Enumerating objects: 4, done. Counting objects: 100% (4/4), done. Delta compression using up to 4 threads Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 281 bytes | 281.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0) To http://XXX.XXX.XXX.XXX/ORG/CantPush.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'http://XXX.XXX.XXX.XXX/ORG/CantPush.git' ``` If I change the 1st line of these three hook files to `#!/bin/bash`, push will be OK,At least looks good. So I have to edit every hook file for every new repository and I am not sure if it works properly.
GiteaMirror added the type/question label 2025-11-02 04:56:19 -06:00
Author
Owner

@lunny commented on GitHub (Apr 23, 2019):

Can you try to change repository.SCRIPT_TYPE = bash on app.ini to /bin/bash ?

@lunny commented on GitHub (Apr 23, 2019): Can you try to change `repository.SCRIPT_TYPE = bash` on app.ini to `/bin/bash` ?
Author
Owner

@FalconWu2017 commented on GitHub (Apr 23, 2019):

Not yet.

#!/usr/bin/env bash
data=$(cat)
exitcodes=""
hookname=$(basename $0)
GIT_DIR=${GIT_DIR:-$(dirname $0)}

for hook in ${GIT_DIR}/hooks/${hookname}.d/*; do
test -x "${hook}" || continue
echo "${data}" | "${hook}"
exitcodes="${exitcodes} $?"
done

for i in ${exitcodes}; do
[ ${i} -eq 0 ] || exit ${i}
done

@FalconWu2017 commented on GitHub (Apr 23, 2019): Not yet. ``` #!/usr/bin/env bash data=$(cat) exitcodes="" hookname=$(basename $0) GIT_DIR=${GIT_DIR:-$(dirname $0)} for hook in ${GIT_DIR}/hooks/${hookname}.d/*; do test -x "${hook}" || continue echo "${data}" | "${hook}" exitcodes="${exitcodes} $?" done for i in ${exitcodes}; do [ ${i} -eq 0 ] || exit ${i} done ```
Author
Owner

@FalconWu2017 commented on GitHub (Apr 24, 2019):

Well down!

@FalconWu2017 commented on GitHub (Apr 24, 2019): Well down!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#2990