Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find out or change url for Git Repository server

I've installed Git and Gitosis on Ubuntu server which has 3 domain names parked. How do I know, which of these domain names are used by Git to construct Git access url, like for example, this: git@xxxxxxxx/repository.git Where can I set up this xxxxxxx value? Thank you in advance, Git looks to be great.

like image 734
Timus83 Avatar asked May 11 '11 10:05

Timus83


2 Answers

(1) As for the domain names - as long as they all resolve to the server IP, it shouldn't matter. Git ultimately connects over SSH, in this case to your gitosis server. If you can connect via SSH to your machine via any of those parked domains, you can use it as your git url.

I don't believe that git allows you to list multiple urls per remote, so if you want to have all three listed (worst case scenario perhaps) just setup three remotes, each with a different domain to your server.

(2) That's really simple. Check out your .git/config file inside your project directory.

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
[remote "origin"]
    url = [email protected]:my_awesome_app
    fetch = +refs/heads/*:refs/remotes/origin/*

You need to update the url; for example, I'm using github :) You can also add other remotes manually. Tracking upstream branches will append their info to this file as well, for example

[branch "master"]
    remote = origin
    merge = refs/heads/master

which follows the above listing is how git manages tracking of remote branches. Hope this helps.

Cheers, Mike.

like image 131
Michael De Silva Avatar answered Sep 18 '22 06:09

Michael De Silva


Any of those domains should work as long as they resolve to the same IP.

like image 23
Mauvis Ledford Avatar answered Sep 22 '22 06:09

Mauvis Ledford