I have a Git repository in a directory served by apache on a server. I have configured WebDAV and it seems to be running correctly. Litmus returns 100% success.
I can clone my repository from a remote host, but when trying to push over http or https, I get the following error:
error: Cannot access URL https://git.example.com/repo/, return code 22 fatal: git-http-push failed
Any idea?
Git can use four distinct protocols to transfer data: Local, HTTP, Secure Shell (SSH) and Git.
If you get a failed to push some refs to error, the main thing to do is git pull to bring your local repo up to date with the remote.
Switching remote URLs from HTTPS to SSH Change the current working directory to your local project. List your existing remotes in order to get the name of the remote you want to change. Change your remote's URL from HTTPS to SSH with the git remote set-url command. Verify that the remote URL has changed.
Pushing commits to a remote repository 1 Renaming branches. To rename a branch, you'd use the same git push command, but you would add one more argument: the name of the new branch. 2 Dealing with "non-fast-forward" errors. ... 3 Pushing tags. ... 4 Deleting a remote branch or tag. ... 5 Remotes and forks. ... 6 Further reading
That URL could be your repository on GitHub, or another user's fork, or even on a completely different server. You can only push to two types of URL addresses: Git associates a remote URL with a name, and your default remote is usually called origin. You can use the git remote add command to match a remote URL with a name.
Push Branch To Remote. In order to push a Git branch to remote, you need to execute the “ git push ” command and specify the remote as well as the branch name to be pushed. $ git push <remote> <branch>. For example, if you need to push a branch named “ feature ” to the “origin” remote, you would execute the following query.
About remote repositories A remote URL is Git's fancy way of saying "the place where your code is stored." That URL could be your repository on GitHub, or another user's fork, or even on a completely different server. You can only push to two types of URL addresses:
Edit the following section of your .git/config file:
[remote "origin"] fetch = +refs/heads/*:refs/remotes/origin/* url = http://git.repository.url/repo.git
to
[remote "origin"] fetch = +refs/heads/*:refs/remotes/origin/* url = http://username:[email protected]/repo.git
Then try git push origin master
.
Edit the authentication details in your config files for other repository URLs as required and push to the required branch.
It is highly suggested NOT to use WebDAV if possible. If you must use HTTP/HTTPS then usage of the git-http-backend CGI script is recommended over WebDAV.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With