Reputation: 351
I'm trying to clone a GitHub repository into the newest release of VSCode (1.3.0). Can this be done natively or do I need to add an extension or additional binary?
I've also searched for a blog article and coming up empty handed so any guidance would be appreciated
Paul
Upvotes: 35
Views: 45210
Reputation: 1328342
Even faster, with VSCode 1.58 (June 2021), for GitHub repositories with the "Open in Visual Studio Code
" badge.
While the announcement was removed, it was replaced with Visual Studio Code for the Web.
The VSCode Web "Opening a project" section mentions:
You can navigate to a project repository directly from a URL, following the scheme:
https://vscode.dev/SOURCE/ORG/REPO
.
Using the VS Code repo as an example, this would look like: https://vscode.dev/github/microsoft/vscode.
And issue 128813 suggests:
I suggest we just use shields.io for this:
https://img.shields.io/static/v1?logo=visualstudiocode&label=&message=Open%20in%20Visual%20Studio%20Code&labelColor=2c2c32&color=007acc&logoColor=007acc
So the mardown would be:
[](https://vscode.dev/SOURCE/ORG/REPO)
Upvotes: 1
Reputation: 1528
There are now two programmatic ways how to clone a repository. VS Code handles the vscode://
protocol now, so you could clone a repository by clicking on a link somewhere on a web page
For example, clicking on the following link invokes VS Code, lets you select a folder on your disk, fetches the code and finally suggests to open that location as a workspace.
vscode://vscode.git/clone?url=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fvscode-extension-samples
Alternatively, if you are trying to trigger the cloning from an extension code, use the built-in VS Code command git.clone
with the repo url as the only argument.
import { commands} from 'vscode';
commands.executeCommand("git.clone", "https://github.com/microsoft/vscode-extension-samples");
Both seem to do the same as the Git: Clone command mentioned by Jakub.
Upvotes: 1
Reputation: 132
I use github Desktop (https://desktop.github.com/) for both my github repos and gitlab repos
Upvotes: -1
Reputation: 5979
Starting from the 1.8 (November) update of vscode you can now clone your Git repository from within the vscode.
You can execute it from the Command Palette. Press F1 (or ⇧+⌘+P on Mac) and search for Git: Clone
. Confirm the command and paste the repository url.
Upvotes: 62
Reputation: 462
If you by native means in the GUI of the application, the answer is no. Though there is an open issue regarding this on their Github repository https://github.com/Microsoft/vscode/issues/9085 it doesn't look like they have the interest to implement it.
Even so, you can of course still clone a repository in your Terminal of choice and then handle the rest of your git functionality through the editor when you're working with the project.
Upvotes: 0