Git push still doesn't work

Git push is failing. Exact same issue as: 22929

The error is:

error: Cannot access URL http://sandbox.domain.com/git/ansible.git/, return code 22
fatal: git-http-push failed

Steps to reproduce:

  1. On a remote host clone the repo: git clone http://sandbox.domain.com/git/ansible.git
Cloning into 'ansible'...
Username for 'http://sandbox.domain.com': sandbox
Password for 'http://sandbox@sandbox.domain.com':
warning: You appear to have cloned an empty repository.

The Apache logs when cloning the repo:

8.8.8.8 - - [17/Jan/2018:13:45:14 -0800] "GET /git/ansible.git/info/refs?service=git-upload-pack HTTP/1.1" 401 381 "-" "git/1.8.3.1"
8.8.8.8 - - [17/Jan/2018:13:45:19 -0800] "GET /git/ansible.git/info/refs?service=git-upload-pack HTTP/1.1" 401 381 "-" "git/1.8.3.1"
8.8.8.8 - sandbox [17/Jan/2018:13:45:19 -0800] "GET /git/ansible.git/info/refs?service=git-upload-pack HTTP/1.1" 200 - "-" "git/1.8.3.1"
8.8.8.8 - sandbox [17/Jan/2018:13:45:19 -0800] "GET /git/ansible.git/HEAD HTTP/1.1" 200 23 "-" "git/1.8.3.1"

2. Add files to repo and attempt to push:

cd ansible
touch test.txt
git add .
git commit -m "Initial commit"
[master (root-commit) a9698e8] test
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 test.txt

git push origin master
Username for 'http://sandbox.domain.com': sandbox
Password for 'http://sandbox@sandbox.domain.com':
error: Cannot access URL http://sandbox.domain.com/git/ansible.git/, return code 22
fatal: git-http-push failed

The apache logs from the git push:

8.8.8.8 - - [17/Jan/2018:13:54:09 -0800] "GET /git/ansible.git/info/refs?service=git-receive-pack HTTP/1.1" 401 381 "-" "git/1.8.3.1"
8.8.8.8 - - [17/Jan/2018:13:54:16 -0800] "GET /git/ansible.git/info/refs?service=git-receive-pack HTTP/1.1" 401 381 "-" "git/1.8.3.1"
8.8.8.8 - sandbox [17/Jan/2018:13:54:16 -0800] "GET /git/ansible.git/info/refs?service=git-receive-pack HTTP/1.1" 200 - "-" "git/1.8.3.1"
8.8.8.8 - sandbox [17/Jan/2018:13:54:16 -0800] "GET /git/ansible.git/HEAD HTTP/1.1" 200 23 "-" "git/1.8.3.1"
8.8.8.8 - - [17/Jan/2018:13:54:16 -0800] "PROPFIND /git/ansible.git/ HTTP/1.1" 401 381 "-" "git/1.8.3.1"

There is nothing in the apache error log.

I've tried initializing the repo with "git --bare init --shared" and it doesn't fix the issue.

Please advise...

Status: 
Active

Comments

So does no line get written to the Apache log at all when you run git push origin master ?

I included the logs in my original request. There's nothing in the error log. Here's the apache log entries after a git push origin master:

8.8.8.8 - - [17/Jan/2018:13:54:09 -0800] "GET /git/ansible.git/info/refs?service=git-receive-pack HTTP/1.1" 401 381 "-" "git/1.8.3.1" 8.8.8.8 - - [17/Jan/2018:13:54:16 -0800] "GET /git/ansible.git/info/refs?service=git-receive-pack HTTP/1.1" 401 381 "-" "git/1.8.3.1" 8.8.8.8 - sandbox [17/Jan/2018:13:54:16 -0800] "GET /git/ansible.git/info/refs?service=git-receive-pack HTTP/1.1" 200 - "-" "git/1.8.3.1" 8.8.8.8 - sandbox [17/Jan/2018:13:54:16 -0800] "GET /git/ansible.git/HEAD HTTP/1.1" 200 23 "-" "git/1.8.3.1" 8.8.8.8 - - [17/Jan/2018:13:54:16 -0800] "PROPFIND /git/ansible.git/ HTTP/1.1" 401 381 "-" "git/1.8.3.1"

Make sure that at Edit Users -> your-login -> Other User Permissions that you have read/write access to the Git repo that you're trying to push to.

The user has permissions to the repo. If I put in a bogus username and password on the git push I get an authentication failure so this tells me it's not an authentication issue.

I've also verified the user has permissions to the GIT repo in question and re-saved the user for good measure and the issue still persists.

Please advise...

To clarify the steps I'm taking are these:

On a remote machine I'm doing a "git clone http://domain.com/git/repo.git"

I then change into the directory. cd repo
I then touch test.txt
git add .
git commit
git push origin master

Am I missing a step somewhere?

You also need to setup authentication to the repository. On the "Git Repositories" page in Virtualmin, click on the "Repository Commands" link to see how to do this.

Here's the instructions

cd ~/public_html/git/ansible
git config remote.upload.url http://user@domain.com/git/ansible.git/
echo machine domain.com login user password $password >> ~/.netrc

Is this supposed to be done on the server or the remote machine? Also note that the directory ~/public_html/git/ansible doesn't exist. The directory is actually ~/public_html/git/ansible.git

Please advise....

On the remote machine. You can replace ~/public_html/git/ansible with whatever directory you are checking out code to.

Here's the commands I performed:

mkdir ansible
cd ansible
git init
git config remote.upload.url http://user@domain.com/git/ansible.git
echo hello > hello.txt
git add hello.txt
git commit -m 'initial checkin'

[master (root-commit) f7ba33e] initial checkin
1 file changed, 1 insertion(+)
create mode 100644 hello.txt


Password for 'http://user@domain.com':
Fetching remote heads...
  refs/
  refs/heads/
  refs/tags/
updating 'refs/heads/master'
  from 0000000000000000000000000000000000000000
  to   f7ba33efc1ae521755975fb2d039867fd7811aa8
    sending 3 objects
MOVE ce013625030ba8dba906f756967f9e9ca394464a failed, aborting (22/502)
MOVE aaa96ced2d9a1c8e72c56b253a0e2fe78393feb7 failed, aborting (22/502)
MOVE f7ba33efc1ae521755975fb2d039867fd7811aa8 failed, aborting (22/502)
Updating remote server info
fatal: git-http-push failed

I also tried this:

git clone http://domain.com/git/ansible.git/
cd ansible/
echo hello > hello.txt
git add hello.txt
git commit -m 'initial checkin'
git push origin master

Fetching remote heads...
  refs/
  refs/heads/
  refs/tags/
updating 'refs/heads/master'
  from 0000000000000000000000000000000000000000
  to   f7503b4a44cd1e9e10ac77ea208972018399e7c6
    sending 3 objects
MOVE ce013625030ba8dba906f756967f9e9ca394464a failed, aborting (22/502)
MOVE aaa96ced2d9a1c8e72c56b253a0e2fe78393feb7 failed, aborting (22/502)
MOVE f7503b4a44cd1e9e10ac77ea208972018399e7c6 failed, aborting (22/502)
Updating remote server info
fatal: git-http-push failed

Here's the logs:

- - [25/Jan/2018:15:09:54 +0000] "GET /git/ansible.git/info/refs?service=git-upload-pack HTTP/1.1" 302 254 "-" "git/1.8.3.1"
- - [25/Jan/2018:15:09:54 +0000] "GET /git/ansible.git/info/refs?service=git-upload-pack HTTP/1.1" 401 381 "-" "git/1.8.3.1"
- mcdonald [25/Jan/2018:15:09:54 +0000] "GET /git/ansible.git/info/refs?service=git-upload-pack HTTP/1.1" 200 - "-" "git/1.8.3.1"
- - [25/Jan/2018:15:09:54 +0000] "GET /git/ansible.git/HEAD HTTP/1.1" 302 225 "-" "git/1.8.3.1"
- mcdonald [25/Jan/2018:15:09:54 +0000] "GET /git/ansible.git/HEAD HTTP/1.1" 200 23 "-" "git/1.8.3.1"
- - [25/Jan/2018:15:10:16 +0000] "GET /git/ansible.git/info/refs?service=git-receive-pack HTTP/1.1" 302 255 "-" "git/1.8.3.1"
- - [25/Jan/2018:15:10:17 +0000] "GET /git/ansible.git/info/refs?service=git-receive-pack HTTP/1.1" 401 381 "-" "git/1.8.3.1"
- mcdonald [25/Jan/2018:15:10:17 +0000] "GET /git/ansible.git/info/refs?service=git-receive-pack HTTP/1.1" 200 - "-" "git/1.8.3.1"
- - [25/Jan/2018:15:10:17 +0000] "GET /git/ansible.git/HEAD HTTP/1.1" 302 225 "-" "git/1.8.3.1"
- mcdonald [25/Jan/2018:15:10:17 +0000] "GET /git/ansible.git/HEAD HTTP/1.1" 200 23 "-" "git/1.8.3.1"
- - [25/Jan/2018:15:10:17 +0000] "PROPFIND /git/ansible.git/ HTTP/1.1" 302 221 "-" "git/1.8.3.1"
- - [25/Jan/2018:15:10:17 +0000] "PROPFIND /git/ansible.git/ HTTP/1.1" 401 381 "-" "git/1.8.3.1"
- mcdonald [25/Jan/2018:15:10:17 +0000] "PROPFIND /git/ansible.git/ HTTP/1.1" 207 546 "-" "git/1.8.3.1"
- - [25/Jan/2018:15:10:17 +0000] "HEAD /git/ansible.git/info/refs HTTP/1.1" 302 - "-" "git/1.8.3.1"
- mcdonald [25/Jan/2018:15:10:17 +0000] "HEAD /git/ansible.git/info/refs HTTP/1.1" 200 - "-" "git/1.8.3.1"
- - [25/Jan/2018:15:10:17 +0000] "HEAD /git/ansible.git/objects/info/packs HTTP/1.1" 302 - "-" "git/1.8.3.1"
- mcdonald [25/Jan/2018:15:10:17 +0000] "HEAD /git/ansible.git/objects/info/packs HTTP/1.1" 200 - "-" "git/1.8.3.1"
- - [25/Jan/2018:15:10:17 +0000] "MKCOL /git/ansible.git/info/ HTTP/1.1" 302 226 "-" "git/1.8.3.1"
- mcdonald [25/Jan/2018:15:10:17 +0000] "MKCOL /git/ansible.git/info/ HTTP/1.1" 405 244 "-" "git/1.8.3.1"
- - [25/Jan/2018:15:10:18 +0000] "LOCK /git/ansible.git/info/refs HTTP/1.1" 302 230 "-" "git/1.8.3.1"
- mcdonald [25/Jan/2018:15:10:18 +0000] "LOCK /git/ansible.git/info/refs HTTP/1.1" 200 471 "-" "git/1.8.3.1"
- - [25/Jan/2018:15:10:18 +0000] "GET /git/ansible.git/objects/info/packs HTTP/1.1" 302 239 "-" "git/1.8.3.1"
- mcdonald [25/Jan/2018:15:10:18 +0000] "GET /git/ansible.git/objects/info/packs HTTP/1.1" 200 1 "-" "git/1.8.3.1"
- - [25/Jan/2018:15:10:18 +0000] "PROPFIND /git/ansible.git/refs/ HTTP/1.1" 302 226 "-" "git/1.8.3.1"
- mcdonald [25/Jan/2018:15:10:18 +0000] "PROPFIND /git/ansible.git/refs/ HTTP/1.1" 207 2403 "-" "git/1.8.3.1"
- - [25/Jan/2018:15:10:18 +0000] "PROPFIND /git/ansible.git/refs/heads/ HTTP/1.1" 302 232 "-" "git/1.8.3.1"
- mcdonald [25/Jan/2018:15:10:18 +0000] "PROPFIND /git/ansible.git/refs/heads/ HTTP/1.1" 207 873 "-" "git/1.8.3.1"
- - [25/Jan/2018:15:10:18 +0000] "PROPFIND /git/ansible.git/refs/tags/ HTTP/1.1" 302 231 "-" "git/1.8.3.1"
- mcdonald [25/Jan/2018:15:10:18 +0000] "PROPFIND /git/ansible.git/refs/tags/ HTTP/1.1" 207 871 "-" "git/1.8.3.1"
- - [25/Jan/2018:15:10:18 +0000] "MKCOL /git/ansible.git/refs/ HTTP/1.1" 302 226 "-" "git/1.8.3.1"
- mcdonald [25/Jan/2018:15:10:18 +0000] "MKCOL /git/ansible.git/refs/ HTTP/1.1" 405 244 "-" "git/1.8.3.1"
- - [25/Jan/2018:15:10:18 +0000] "MKCOL /git/ansible.git/refs/heads/ HTTP/1.1" 302 232 "-" "git/1.8.3.1"
- mcdonald [25/Jan/2018:15:10:19 +0000] "MKCOL /git/ansible.git/refs/heads/ HTTP/1.1" 405 250 "-" "git/1.8.3.1"
- - [25/Jan/2018:15:10:19 +0000] "LOCK /git/ansible.git/refs/heads/master HTTP/1.1" 302 238 "-" "git/1.8.3.1"
- mcdonald [25/Jan/2018:15:10:19 +0000] "LOCK /git/ansible.git/refs/heads/master HTTP/1.1" 200 471 "-" "git/1.8.3.1"
- - [25/Jan/2018:15:10:19 +0000] "PROPFIND /git/ansible.git/objects/f7/ HTTP/1.1" 302 232 "-" "git/1.8.3.1"
- mcdonald [25/Jan/2018:15:10:19 +0000] "PROPFIND /git/ansible.git/objects/f7/ HTTP/1.1" 207 1714 "-" "git/1.8.3.1"
- - [25/Jan/2018:15:10:19 +0000] "PROPFIND /git/ansible.git/objects/aa/ HTTP/1.1" 302 232 "-" "git/1.8.3.1"
- mcdonald [25/Jan/2018:15:10:19 +0000] "PROPFIND /git/ansible.git/objects/aa/ HTTP/1.1" 207 1713 "-" "git/1.8.3.1"
- - [25/Jan/2018:15:10:19 +0000] "PROPFIND /git/ansible.git/objects/ce/ HTTP/1.1" 302 232 "-" "git/1.8.3.1"
- mcdonald [25/Jan/2018:15:10:19 +0000] "PROPFIND /git/ansible.git/objects/ce/ HTTP/1.1" 207 1713 "-" "git/1.8.3.1"
- - [25/Jan/2018:15:10:20 +0000] "PUT /git/ansible.git/objects/aa/a96ced2d9a1c8e72c56b253a0e2fe78393feb7_d4d3de8622299e219c3bb8df0c73be79b3ca8a8b HTTP/1.1" 302 311 "-" "git/1.8.3.1"
- - [25/Jan/2018:15:10:20 +0000] "PUT /git/ansible.git/objects/ce/013625030ba8dba906f756967f9e9ca394464a_d4d3de8622299e219c3bb8df0c73be79b3ca8a8b HTTP/1.1" 302 311 "-" "git/1.8.3.1"
- - [25/Jan/2018:15:10:20 +0000] "PUT /git/ansible.git/objects/f7/503b4a44cd1e9e10ac77ea208972018399e7c6_d4d3de8622299e219c3bb8df0c73be79b3ca8a8b HTTP/1.1" 302 311 "-" "git/1.8.3.1"
- - [25/Jan/2018:15:10:20 +0000] "PUT /git/ansible.git/objects/aa/a96ced2d9a1c8e72c56b253a0e2fe78393feb7_d4d3de8622299e219c3bb8df0c73be79b3ca8a8b HTTP/1.1" 401 381 "-" "git/1.8.3.1"
- - [25/Jan/2018:15:10:20 +0000] "PUT /git/ansible.git/objects/f7/503b4a44cd1e9e10ac77ea208972018399e7c6_d4d3de8622299e219c3bb8df0c73be79b3ca8a8b HTTP/1.1" 401 381 "-" "git/1.8.3.1"
- mcdonald [25/Jan/2018:15:10:20 +0000] "PUT /git/ansible.git/objects/ce/013625030ba8dba906f756967f9e9ca394464a_d4d3de8622299e219c3bb8df0c73be79b3ca8a8b HTTP/1.1" 201 279 "-" "git/1.8.3.1"
- mcdonald [25/Jan/2018:15:10:20 +0000] "PUT /git/ansible.git/objects/aa/a96ced2d9a1c8e72c56b253a0e2fe78393feb7_d4d3de8622299e219c3bb8df0c73be79b3ca8a8b HTTP/1.1" 201 279 "-" "git/1.8.3.1"
- - [25/Jan/2018:15:10:20 +0000] "MOVE /git/ansible.git/objects/ce/013625030ba8dba906f756967f9e9ca394464a_d4d3de8622299e219c3bb8df0c73be79b3ca8a8b HTTP/1.1" 302 311 "-" "git/1.8.3.1"
- - [25/Jan/2018:15:10:20 +0000] "MOVE /git/ansible.git/objects/aa/a96ced2d9a1c8e72c56b253a0e2fe78393feb7_d4d3de8622299e219c3bb8df0c73be79b3ca8a8b HTTP/1.1" 302 311 "-" "git/1.8.3.1"
- mcdonald [25/Jan/2018:15:10:20 +0000] "MOVE /git/ansible.git/objects/ce/013625030ba8dba906f756967f9e9ca394464a_d4d3de8622299e219c3bb8df0c73be79b3ca8a8b HTTP/1.1" 502 253 "-" "git/1.8.3.1"
- mcdonald [25/Jan/2018:15:10:20 +0000] "MOVE /git/ansible.git/objects/aa/a96ced2d9a1c8e72c56b253a0e2fe78393feb7_d4d3de8622299e219c3bb8df0c73be79b3ca8a8b HTTP/1.1" 502 253 "-" "git/1.8.3.1"
- mcdonald [25/Jan/2018:15:10:20 +0000] "PUT /git/ansible.git/objects/f7/503b4a44cd1e9e10ac77ea208972018399e7c6_d4d3de8622299e219c3bb8df0c73be79b3ca8a8b HTTP/1.1" 201 279 "-" "git/1.8.3.1"
- - [25/Jan/2018:15:10:20 +0000] "MOVE /git/ansible.git/objects/f7/503b4a44cd1e9e10ac77ea208972018399e7c6_d4d3de8622299e219c3bb8df0c73be79b3ca8a8b HTTP/1.1" 302 311 "-" "git/1.8.3.1"
- - [25/Jan/2018:15:10:20 +0000] "MOVE /git/ansible.git/objects/f7/503b4a44cd1e9e10ac77ea208972018399e7c6_d4d3de8622299e219c3bb8df0c73be79b3ca8a8b HTTP/1.1" 401 381 "-" "git/1.8.3.1"
- mcdonald [25/Jan/2018:15:10:20 +0000] "MOVE /git/ansible.git/objects/f7/503b4a44cd1e9e10ac77ea208972018399e7c6_d4d3de8622299e219c3bb8df0c73be79b3ca8a8b HTTP/1.1" 502 253 "-" "git/1.8.3.1"
- - [25/Jan/2018:15:10:20 +0000] "UNLOCK /git/ansible.git/refs/heads/master HTTP/1.1" 302 238 "-" "git/1.8.3.1"
- mcdonald [25/Jan/2018:15:10:20 +0000] "UNLOCK /git/ansible.git/refs/heads/master HTTP/1.1" 204 - "-" "git/1.8.3.1"
- - [25/Jan/2018:15:10:20 +0000] "PROPFIND /git/ansible.git/refs/ HTTP/1.1" 302 226 "-" "git/1.8.3.1"
- mcdonald [25/Jan/2018:15:10:20 +0000] "PROPFIND /git/ansible.git/refs/ HTTP/1.1" 207 2403 "-" "git/1.8.3.1"
- - [25/Jan/2018:15:10:20 +0000] "PROPFIND /git/ansible.git/refs/heads/ HTTP/1.1" 302 232 "-" "git/1.8.3.1"
- mcdonald [25/Jan/2018:15:10:20 +0000] "PROPFIND /git/ansible.git/refs/heads/ HTTP/1.1" 207 873 "-" "git/1.8.3.1"
- - [25/Jan/2018:15:10:21 +0000] "PROPFIND /git/ansible.git/refs/tags/ HTTP/1.1" 302 231 "-" "git/1.8.3.1"
- mcdonald [25/Jan/2018:15:10:21 +0000] "PROPFIND /git/ansible.git/refs/tags/ HTTP/1.1" 207 871 "-" "git/1.8.3.1"
- - [25/Jan/2018:15:10:21 +0000] "UNLOCK /git/ansible.git/info/refs HTTP/1.1" 302 230 "-" "git/1.8.3.1"
- mcdonald [25/Jan/2018:15:10:21 +0000] "UNLOCK /git/ansible.git/info/refs HTTP/1.1" 204 - "-" "git/1.8.3.1"

Also note that doing a "git push upload master" produces this result which is why I've been doing a "git push origin master"

git push upload master
fatal: 'upload' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights

It's doing more than it did last time so it appears something changed in the latest release of virtualmin but it's still not able to push.

Please advise...

Whatever was changed in virtualmin within the past few days appears to have fixed the issue.

On that last attempt I made I wasn't using https although I was using HTTPS in previous attempts prior to this latest release and it didn't work. The url I was cloning was git clone http://mcdonald.lol/git/ansible.git/ which didn't work. Since this site is SSL enabled with HTTP redirects to HTTPS the correct url to use is git clone https://domain.com/git/ansible.git/

Furthermore for anyone having issues here's the commands to use the git functionality of virtualmin:

echo machine domain.com login domainuser password $password >> ~/.netrc git clone https://domain.com/git/ansible.git/ cd ansible touch test.txt git add . git commit -m "initial commit" git push origin master

Thank you!

Glad to hear that it's working, although we didn't release any update that would effect this.