How to publish/install VS Code extensions via github.com instead using of dev.azure.com?
I assume the steps would look like:
git clone 'https://github.com/abc/xyz.git'
vsce package
git add -A && git commit -m 'initialized vscode extension'
git push origin
and then in VS Code there would be some option to install a plugin from https://github.com/abc/xyz.git
is this possible?
VS Code can install a vsix package (which is actually a zip), but that must be in the local file system. You cannot specify a URL as source.
On a macOS/Linux machine, you can do this:
assume your VS Code extension is hosted at https://github.com/abc/xyz.git
git clone 'https://github.com/abc/xyz.git'
ln -s "$PWD/xyz" "$HOME/.vscode/extensions/xyz" (create a softlink)
When you open VS Code, if you look in installed extensions, it will show your extension. No need to compile anything to vsix, it runs your JavaScript. In other words, create your git repo that represents your VS Code extension, clone it locally, and symlink that folder to ~/.vscode/extensions/xyz. I am sure on Windows that the concept is the same.
Related
Using the following programs and interfaces:
R-4.2.2 for Windows
RStudio Desktop: Open Source Edition (AGPL v3)
Git Bash
GitHub
I am currently in the early stages of a tech program learning Data Analytics.
On my PC, working within RStudio, I've created a project that is currently not under version control. I am trying to get it set up to interact with Git.
When I type in my command (cd ~/dir/name/of/path/to/file) for it to move around and navigate to the directory containing my files, I keep getting this error message:
bash: cd: /c/Users/Administrator.STEPHHOWERTON/dir/name/of/path/to/file: No such file or directory"
I've tried creating different pathways. My original directory pathway was:
cd: /c/Users/Administrator.STEPHHOWERTON/RStudio Projects/Temporary_add_to_version_control
Then I tried to simplify by creating a easier path like the example in my module:
c/Desktop/Temporary_add_to_version_control
No luck with either.
I went ahead to try initialize the directory to as a Git repository and also tried to add files, but of course it said the directory was empty.
Any help would be greatly appreciated.
It is best to switch to command line (simple CMD, no bash required), after having installed Git for Windows.
Go to the root folder of your repository (not path/to/file, but path/to/root/folder/of/repository), where your project is.
You can then create a repository
git init .
git add .
git config --global user.name "your name"
git config --global user.email "your#email.com"
git commit -m "Import project"
If you need to create a GitHub repository and push your project, you can, from that same folder, after installing GitHub CLI gh, use gh auth login (with a classic PAT, scope repo):
gh auth login --with-token < echo ghp_...
Then gh repo create:
gh repo create my-project --public --source=. --push
You can reopen RStudio from there, and check everything is working.
In our project Change-id is mandatory for commits, but I did not found how to add it in Visual Studio Code.
I downloaded the "Gerrit" plug-in, but even so I did not fond a way to add the Change-ID
Any idea?
You need to install the "commit-msg" hook in the ".git" directory of your local repository.
See more details in the Gerrit documentation here.
Basically you need to go (cd) to your local repository and execute the following command:
gitdir=$(git rev-parse --git-dir); curl --create-dirs -Lo ${gitdir}/hooks/commit-msg https://GERRIT-SERVER/tools/hooks/commit-msg; chmod u+x ${gitdir}/hooks/commit-msg
After that, every time you create a new commit or change (--amend) an old one, the Change-Id will be automatically added.
I would like to use WSL (Bash on Windows) Git with VSCode instead of Git for Windows to avoid multiple Git installations.
I created a simple bat script to emulate git.exe comportment by redirecting git commands in WSL. It works nicely in CMD but not with VSCode. Also, WSL is my default terminal in VSCode.
VSCode settings.json:
{
"git.path": "D:\\tools\\git.bat",
"terminal.integrated.shell.windows": "C:\\Windows\\Sysnative\\bash.exe"
}
and git.bat:
#echo off
bash -c 'git %*'
Any idea to make VSCode working with WSL Git ?
Since VS Code 1.34 (April 2019) a remote extension has been introduced to develop into WSL: https://code.visualstudio.com/docs/remote/wsl.
Basically, a server instance of VS Code is started into WSL, allowing you to use all the WSL tools (e.g. git) from your client instance on Windows.
Thank you for pointing that out #Noornashriq Masnon!
I created a small tool to solve this for myself, and hosted it on GitHub.
Basic git functionality seems to work, like viewing changes and committing.
A ready-to-use binary can be downloaded from the Releases page.
One of the problems is that the input paths need to be translated from the Windows representation (C:\Foo\Bar) to the Linux paths in WSL (/mnt/c/Foo/Bar), and back again for paths in the output of git.
For example, the Git plugin in VSCode uses the command
git rev-parse --show-toplevel
to find the root directory of the git repository, but with WSL git this of course returns a Linux path that needs to be translated for VSCode on Windows.
Provide the full path for the bash exec :
git.bat :
#echo off
c:\windows\sysnative\bash.exe -c "git %*"
What you can do is to first try wslpath and if that fails you try a normal git command. It's not ideal but it works.
See: Use WSL git inside VS Code from Windows 10 17046
I originally set up git in Rstudio while enrolled in the Data Scientist's Toolbox course at Coursera. Unfortunately, I did this in my phd project. The repository no longer exists on github. I am now attempting to write my thesis in rmarkdown using knitr and bookdown. I would like to use version control, both to learn proper git workflow and to have a structured back up of everything I have done in my thesis. However, I have been unable to change the version control repository in Rstudio.
I am unable to change this in the Tools > Version control > Project setup > Git/SVN menu. The Origin: textbox is unchangable.
I tried creating a new project using the old phd project's working directory. This also cloned the version control settings.
How do I change the origin to accomplish what is described above?
Git, Github and Rstudio are different things. You could use git as local version control tools. You might connect your local repo to Github account which is based on git by push/pull. Rstudio just makes a user interface for git and supplies the function to push the repo into remote server based on git to make version control(not only Github, but also Gitlab).
So for your issue, if you do not want to pay for github for a private repo, all of your code would be public and I don't think it is good before your finally finished your thesis. But version control could be made locally with git only. Just use git shell to control the version.
However, as a student, github could support private repo here for you. Just register and find your student package. Then just remove the url for remote repo after you cd to your workdir in command line, use the following code to find your remote url(mostly you might fing origin):
git remote -v
Then use this to remove them:
git remote rm origin
Now you could use version control locally. If you want to connect this repo to your remote github private repo, use this:
git remote add origin https://github.com/[YourUsername]/[YourRepoName].git
RStudio would find this information about git and support your following operation. Project in RStudio is different with git, although project support git as version control tool. So you need git in command line or shell to solve your problem.
This can be done by opening /your.project/.git/config
and editing the remote origin line(s), e.g. changing from git to https.
Restart Rstudio & you'll be prompted for your github username & password.
This is what worked for me for migrating from github to Azure
Go to the top right Git window in RStudio and click on the gear. Now click Shell (to open the terminal there).
#remove origin
git remote rm origin
#add new origin like Azure for me via HTTPS
git remote add origin https://USER#dev.azure.com/USER/PROJECT/_git/REPONAME
#push your local repro
git push -u origin --all
#in my case put in the PAT password if you needed to generate one.
After testing, I found some clue
Actually Rstudio is not really smart about this setting
It will first search for the git file in the Rproject folder where your Rporject file is located
if it could not, then it goes up to the folder contains your Rproject folder
However, for version control you only need coding files while RProject may contains some big files like .RData some pictures etc.
I don't find a way to manually disrupt this logic flow, the only thing you can do is to delete the current git repository setting files(which is .git folder and 2 other git setting files), then Rstudio may ask you if you want to init a new one.
I started today working with gamejs for a small project. I saw that most project are repository files on github dot com, so I downloaded the github for windows and the git bash.
Then I used git bash to clone gamejs repository. I proceed the same with some repository stuff. However, it seems that I forget to install something... because I cannot start the server, I have gjs-server.sh or .cmd missing. The bash doesnt recognize the command. What will I do?
Since you cloned the code instead of downloading the release tarball you need to build GameJS first:
Change into the GameJs directory
cd gamejs
Get all needed submodules with git:
git submodule init git submodule update
Compile RingoJs:
ant -f ./server/ringojs/build.xml jar
EDIT: Prior to building you need to install Apache Ant build tool. Since it is a Java application to install it just download the binary distribution from their download page and unzip it.