Is there a way to disable "Clone in VSCode" #12039

Closed
opened 2025-11-02 09:55:46 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @haq1an on GitHub (Nov 18, 2023).

Description

This might not be categorized as "Bug", but I couldn't find a more proper type.

I'm looking for a way to disable "Clone in VSCode".

I tried enable "DISABLE DOWNLOAD_SOURCE_ARCHIVES" in the app.ini, but it just deleted all the other options but the vscode one. Also, I don't think this parameter actually blocks http/ssh request, correct me if I'm wrong. Cuz I find that the vscode option calls local vscode app, hence I couldn't do anything on the network level to deny it. Even if the button is gone, users can still trigger it if they know the uri.

Is there a parameter I was missing that can achieve what I'm trying to do? Or which part of the source code I should be looking for to make it happen?

Gitea Version

1.19.2

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

2.25

Operating System

Ubuntu 20.04

How are you running Gitea?

Installed by binary.

Database

PostgreSQL

Originally created by @haq1an on GitHub (Nov 18, 2023). ### Description This might not be categorized as "Bug", but I couldn't find a more proper type. I'm looking for a way to disable "Clone in VSCode". I tried enable "DISABLE DOWNLOAD_SOURCE_ARCHIVES" in the app.ini, but it just deleted all the other options but the vscode one. Also, I don't think this parameter actually blocks http/ssh request, correct me if I'm wrong. Cuz I find that the vscode option calls local vscode app, hence I couldn't do anything on the network level to deny it. Even if the button is gone, users can still trigger it if they know the uri. Is there a parameter I was missing that can achieve what I'm trying to do? Or which part of the source code I should be looking for to make it happen? ### Gitea Version 1.19.2 ### Can you reproduce the bug on the Gitea demo site? Yes ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version 2.25 ### Operating System Ubuntu 20.04 ### How are you running Gitea? Installed by binary. ### Database PostgreSQL
Author
Owner

@lng2020 commented on GitHub (Nov 21, 2023):

I don't think there is an option because it's hard-coded. You can remove that js-clone-url-vsc line.
247927a9b5/templates/repo/home.tmpl (L133-L143)

@lng2020 commented on GitHub (Nov 21, 2023): I don't think there is an option because it's hard-coded. You can remove that `js-clone-url-vsc` line. https://github.com/go-gitea/gitea/blob/247927a9b51cea88db6f7d2dee25471339feb51b/templates/repo/home.tmpl#L133-L143
Author
Owner

@haq1an commented on GitHub (Nov 21, 2023):

I don't think there is an option because it's hard-coded. You can remove that js-clone-url-vsc line.

247927a9b5/templates/repo/home.tmpl (L133-L143)

This is what I've done so far.

Just to add a bit background story here:
Our dev team is trying to secure the our code without effecting too much user experience. So I put the gitea server in our bastion network, allowing port 3000 traffic only for webui access, and I disabled downloading use app.ini. Therefore, user can only get access(clone/download) codes within the bastion network with authentication and audit.(I understand that it's more of a low-hanging fruit situation, like user can still do copy/paste.)

So as you can see, the vscode clone function doesn't really fit my design and I can do very little thing about it since it's hardcoded and not manageable on the network level. So it might be nice to add a switch to this feature in the future release.

But still, thanks for the frontend solution.

@haq1an commented on GitHub (Nov 21, 2023): > I don't think there is an option because it's hard-coded. You can remove that `js-clone-url-vsc` line. > > https://github.com/go-gitea/gitea/blob/247927a9b51cea88db6f7d2dee25471339feb51b/templates/repo/home.tmpl#L133-L143 This is what I've done so far. Just to add a bit background story here: Our dev team is trying to secure the our code without effecting too much user experience. So I put the gitea server in our bastion network, allowing port 3000 traffic only for webui access, and I disabled downloading use app.ini. Therefore, user can only get access(clone/download) codes within the bastion network with authentication and audit.(I understand that it's more of a low-hanging fruit situation, like user can still do copy/paste.) So as you can see, the vscode clone function doesn't really fit my design and I can do very little thing about it since it's hardcoded and not manageable on the network level. So it might be nice to add a switch to this feature in the future release. But still, thanks for the frontend solution.
Author
Owner

@lafriks commented on GitHub (Nov 21, 2023):

This should not be created as option in app.ini if this only for customizing UI. This can be already be implemented by adding custom css:

.js-clone-url-vsc { display: none }

If also download is disabled than can be added as css:

#clone-panel > #more-btn { display: none }
@lafriks commented on GitHub (Nov 21, 2023): This should not be created as option in app.ini if this only for customizing UI. This can be already be implemented by adding custom css: ```css .js-clone-url-vsc { display: none } ``` If also download is disabled than can be added as css: ```css #clone-panel > #more-btn { display: none } ```
Author
Owner

@mstup commented on GitHub (Mar 26, 2024):

I would vote to add this possibility to control it in app.ini file.

@mstup commented on GitHub (Mar 26, 2024): I would vote to add this possibility to control it in **app.ini** file.
Author
Owner

@wxiaoguang commented on GitHub (Mar 26, 2024):

It could be now!

In 1.22, go to admin panel -> config -> setting, you could fully customize the "clone" apps now.

-> Customizable "Open with" applications for repository clone #29320


ps: at the moment, the config option needs at least one customized "clone app". If there is a strong requirement to hide all "clone apps", it could introduce a new option on that panel, it won't be too complex IMO

@wxiaoguang commented on GitHub (Mar 26, 2024): It could be now! In 1.22, go to admin panel -> config -> setting, you could fully customize the "clone" apps now. -> Customizable "Open with" applications for repository clone #29320 ---- ps: at the moment, the config option needs at least one customized "clone app". If there is a strong requirement to hide all "clone apps", it could introduce a new option on that panel, it won't be too complex IMO
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#12039