Execute code in a github remote depot vscode - github

I use the vscode extension to modify code in a github depot but i would like to know if it is possible to execute the code without downloading it

You could add a GitHub Action in your repository, which would checkout your repository, on demand, when you trigger it manually.
That same GitHub Action ca, execute any command you want inside the checked out repository (on Azure server: no need to download the code).
The GitHub Actions for VS Code could be used to trigger that same workflow directly from your VSCode, but might imply a clone first.

Related

Why does Visual Studio Code force me to use a remote GitHub repository?

Having initialised a local repo and made an initial commit, VS code prompts me to 'Publish Branch' on GitHub.
I don't want to use GitHub as I am happy using a local repo in this case. Is this possible? I can't find an option to ignore the 'Publish Branch' prompt.
Before initializing a repository:
After initializing a repository:
After committing:
It's not really forcing you or prompting you to publish your repo to Github.
It's more of an option, a hint, or a recommendation, since when someone uses Git, they typically would want to push/publish their local copy of the repo to some remote copy of the same repo (ex. for sharing with other members of your team, etc.). But it's perfectly fine with Git and with Visual Studio Code's Source Control functions if all you want is to maintain it all locally. It shouldn't be blocking you from doing further local commits.
So
I don't want use GitHub do as I am happy using a local repo in this case - is this possible?
YES.
I can't find an option to ignore the 'Publish Branch' prompt.
If you don't want to see that button, you can hide it with the setting Git: Show Unpublished Commits introduced in VS Code 1.61 September 2021
By default, the Git extension will add a Sync Changes button as shown above, if there are unpushed commits, or a Publish Changes button if the branch hasn't yet been published. Additionally, users can customize this behavior by configuring the git.showUnpublishedCommitsButton setting, which defaults to whenEmpty so that the button will only be shown if there are unpushed commits and there are no other changes in the view.
"git.showUnpublishedCommitsButton": "never"
Just thought it looked a little odd as it differed from (albeit old) docs showing nothing, seemed intrusive, and was different to what I'm used to.
It's probably part of the continuous updates that further integrated Github with VS Code's UI (since both are now owned by Microsoft). The section on Initializing a Repository doesn't mention that it's required to publish to Github or to any other provider.
And to be clear, you can use pretty much any remote repo server/provider. It doesn't have to be Github. (Although the built-in UI is specifically tailored to use Github.)

How to refere to tfvc from a git repo triggerd build in visual studio online

We are migrating to git and have some powershell scripts that worked properly with tfvc, but fail during a git repo triggerd build.
The reason for that is that the tfvc is not accessible in the "Script path field", as it used to be trough $\TeamName\..\..\..
The build agent seems to look at the build path instead of tfvc when the dollar sign reference is used. e.g. :Invalid file path 'D:\a\1\s\$\..\..etc
Am I overlooking something or are the only possible solutions
Nuget package it, and restore during build
Or include the script in the git repo?
In a build definition, you can either select a Git source or a TFVC source, check the screenshot below:
If you choose a Git source, you are not able to access a TFVC source. So you can either select TFVC source as before, or import all resources that the build need to a repo and select Git source. For the latter, you can refer to import a repo from TFVC, then you can select the correct script path in the Powershell task.
If you would like to use Powershell scripts but don't want to include them in the git repository because they are used by multiple build definitions(cross repo). You can use the the in-line Powershell task type.
To circumvent the limitation of 5000 characters, use f12 to change the max size of the field. It is just a ui "limitation".

Is it possible to create github repository for my project in Visual Studio Code?

Is it possible to create github repository for my project in Visual Studio Code,
and commit all the files?
I have not found a single example where a repository is created from VSCode.
Now, there is also a "Publish to Github" button in the "Source Control" part, when there is no git repository, to directly create a repository on github.
If you click on it, by default, VSCode propose (in the main bar) to create a private or a public repository with the project's folder name.
Just make a new file in VS Code. Local file created in VSCode
Go to Source Control. You will have an option to Initialize Repository, which inturn creates a repo in Github.
Note : You need to connect to your github account before hand.
There is documentation on this page on how to initialize a repository in vsCode: https://code.visualstudio.com/docs/editor/versioncontrol
EDIT:
Another link that should be helpful: https://code.visualstudio.com/docs/introvideos/versioncontrol
Use GitHub API to create repo. Outside of the API, there's no way to create a repo on GitHub via the command line.
curl -u 'username' https://api.github.com/user/repos -d '{"name":"projectname","description":"project desc"}'
git remote add origin git#github.com:nyeates/projectname.git
As far as I can tell, it's currently not possible with a default installation of VS Code. But you can make it work like this:
Add the REST API client by Huachao Mao to VS Code (others may work, haven't tested).
Create a personal access token in GitHub.
Create a new temporary file and enter the following text:
curl -u 'myGitHubUsername:myToken' "https://api.github.com/user/repos" -d '{"name":"MyNewRepo","description":"Repo Description"}'
Then select the line, press F1, look for "REST" in the search field and run the command "Rest Client: Send request"
After a short while you should be able to add the new remote repo using onboard tools.
Obviously, this is too elaborate for a one-time use. But once it's all set up, it's quite easy to create new repos or interact with the GitHub API in other ways.

Visual Studio Code GitHub account

I have a Visual Studio Code project for an Angular2 app created using AngularCli (webpack version). Out of the box, AngularCli will generate a new project for you and check it into Git. How do you know which GitHub account it's using? I cannot find any information in Visual Studio as to what GitHub account is controlling the code history. I can make changes to the code and check it in using Visual Studio Code's embedded Git functionality. I've logged into GitHub using my account, but I do not see this new project. Where do you find information on what GitHub account either AngualrCli and/or Visual Studio Code is using?
How do you know which GitHub account it's using?
It doesn't need to use any github account to create a git repo. It's just calling git init, followed by some git add/git commit commands. You can do those without github credentials. After the tool does its job, you have a fully-functional local git repo.
You only need github account when you try to push code to github, which you did not yet do, I assume. You don't need github credentials to work with local repository (view history, add new commits, branch, merge, etc.)

I want to create gradle script to checkout the code from gitHub as soon as deveoper checkin to repository.?

I can checkout the code from github using import org.ajoberstar.gradle.git.tasks.*
. But I want to check out the code immediately after code checkined to github repository automatically and deploys it into web server.Is there any plugin to identify the commit history in github repo.Or some other ways to do it.
Two options I can think of:
Use a git commit hook to trigger the gradle task.
Periodically poll git log to check for new commits (you might be able to use gradle's new continuous mode to achieve this)