Shihe Zhang
Shihe Zhang

Reputation: 2771

Is it possible to make the git repo url shorter by any setting on private server

I config a private git server on win10 64bit system. I used CopSSH service and putty client. Now I can clone a repo successfully.

HOWEVER

The repo url looks like this

ssh://user@server:22/Program Files (x86)/ICW/home/hp/myapp.git

Since I use Copssh, I put things under ICW/home while ICW is under Program Files (x86).
I want to the urls look and alsoI want to be able to put the repo in other place won't occupy too much disk of my C:\

Is there any way to do it?

Upvotes: 1

Views: 240

Answers (2)

ElpieKay
ElpieKay

Reputation: 30868

On the client side,

git config --global -e

Add the following lines.

[url "ssh://user@server:22/Program Files (x86)/ICW/home/hp/myapp.git"]
        pushInsteadOf = ssh://myapp.git
[url "ssh://user@server:22/Program Files (x86)/ICW/home/hp/myapp.git"]
        insteadOf = ssh://myapp.git

When you clone the repo, just run git clone ssh://myapp.git. The push and fetch urls of origin will be ssh://user@server:22/Program Files (x86)/ICW/home/hp/myapp.git so the push and fetch will work as expected.

Other users with this config are able to use ssh://myapp.git as an alternative as long as they use the right user before @server:22 in their own git-config. The ssh:// could be git:// or http://.

With the help of insteadOf and pushInsteadOf, you can assign one url to origin for push and another different url for fetch. If the two urls are the same, the pushInstaedOf part can be omitted.

Upvotes: 0

VonC
VonC

Reputation: 1323883

As show in this tutorial, you don't have to install CopSSH in Program Files

Install CopSSH

a. Just like the msysgit, we don’t install the CopSSH in program files folder to avoid some space issues. We install it to c:\ICW

http://www.jinweijie.com/wp-content/uploads/2011/12/image5.png

That way, the url for any repo will be shorter.

Upvotes: 0

Related Questions