Redirecting http requests to git resources to github.com - github

I'm wondering if it would be possible to use vanity URLs for git repositories without to mirror the repository itself. Basically to just and issue redirects. Example: I would like to make my github repository available on mydomain.com/repoName. When someone tries to clone push etc to this remote I would issue a redirect to github.com/myusername/myrepo. Is a such thing possible ?

This is definitely not a git issue. It's about redirecting http requests to corresponding URLs on github. I don't know if there's anything that does it "out of the box" but given the nice resources names on github, I think a few lines in your http server config file should do it.

Related

Azure DevOps submodule addressing

In my organization, some people use ssh: while others use https: when accessing Git on Azure DevOps.
This causes a problem with submodules, as the .gitmodules file usually holds the full URL to the submodules repository (which obviously are different for https: and ssh:).
You can also use relative paths in .gitmodules though. If the submodule is another repository in the same project, the URL is simply ../{repository}.
If the submodule is in another project in the same Azure Devops organization, the URL is simply ../../{project}/{repository}, right?
Well, for ssh: the answer is yes, but for https: the URL unfortunately is ../../../{project}/_git/{repository}.
Why on earth MS designed it like this, is beyond me.
My question is: Does anyone have a solution for this? Is Git URL rewrite a feasible solution?
PS. If you think this is less than optimal design by MS, you might want to upvote my suggestion to MS here: https://developercommunity.visualstudio.com/t/Drop-the-_git-in-the-Git-https-URL/1643086?space=21&entry=suggestion
PPS. If you clone a repository via https: and successively modify your .gitmodules url to ../../{project}/{repository}, it apparently works. But you wont be able to clone it again via https: with this modified .gitmodules.

Using Eclipse and eGit - after the initial setup, how do I tell what protocol is being used, i.e. ssh or not?

We have a small team of developers working on a project that works with a Git repository hosted by TFS that is already owned by the customer. We are using Eclipse and eGit. How can I tell what protocol is being used when we do pull and push? I can see the URL but i'm not sure how to tell what the protocol is.. I'm interested in knowing if SSH is involved.
git remote get-url --all origin
will to display information about URLs of the remote. If they start with https then http is used. If they start with user#server.domain then, most likely, ssh is used.

Tunnel or SSL Forbidden

I get this error. Something wrong with the proxy setup, though I can download software updates in eclipse with the same settings, but am not able to push my commits to github.
Github allows you to access a repository with different protocols.
If a https proxy is your only way outside you should use an https url to access you repository.
Just replace the ssh:// with https:// and you should be fine.

Synchronize github with godaddy account

I develop front-end and back-end of many websites hosted on godaddy. I was looking for a way to synchronize the godaddy file manager with my local repository so as to prevent me from uploading the edited files each time. I push my code to github directly, but is there a way to push the code directly to godaddy account without using its file manager?
Also sometimes, with other systems, I edit the code directly on the server if I get some problems with the code, which becomes then difficult to get it on my local system.
It would be of great help to directly push it without using the file manager each time.
It would be best to:
install Git on Godaddy (as in this blog post)
setup a bare repo on the upstream side (ie, the GoDady side, the one where you would push your code)
add a post-receive hook on that upstream repo in order for a non-bare repo to update itself: see links in the "Is --bare option equal to core.bare config in Git?" answer.

Mercurial deployment

I'm quite new to mercurial so this might sound silly..
I am developing a PHP application locally and pushing changes to remote linux server. I have a hgweb.wsgi script publishing my repository which is accessible via url (hg.example.com/repository).
Now I am wondering what is the best way to automate deployment of the app to see it in action on the same server as repository? Obviously I can't just go to hg.example.com/repository since it just shows the web interface of the repository and not the app..
You're mixing up two things which are not necessarily related:
the path part of the URL of your repository, and
the path of the actual repository on your server.
To get a better picture, consider we use SSH, not HTTP, for repository access. This means we probably specify the full path to the repo in the server file system within the path, e.g., to sync with my server in a similar setup, I push to ssh://example.com//var/www/wsgi/example.com (I have a WSGI app, not a PHP one, but that's not important now). The app itself is available at http://example.com/, i.e., site root if /var/www/wsgi/example.com.
Well now, nothing can prevent me to set up HTTP access to this repo using hgweb on a hg.example.com subdomain, so the repo push path is http://hg.example.com/example.com.
Thus:
I push to http://hg.example.com/example.com (repo pulished at this URL)
The repo is located under /var/www/wsgi/example.com (server file system path)
This directory is in some way set up to be considered the site root by the web server
Site root = http://example.com/
P.S. Don't forget about the changegroup hook Ton mentioned.
There are two things you'll need to do:
Add a webserver that can serve PHP-pages (like apache) and let it serve the repository root (as always make sure it's save)
Add a hook to the mercurial server for the changegroup hook. This hook can be as simple as:
update.changegroup = hg up
That will update the working folder of the repository with the latest version.