Smart Working via VS Code, VS Code Online and Github even if you don't have Admin credentials.

This article won't be much so related to Javascript in particular and could apply for any stack and any language. It is about first step for work remotely, as a developer that has to work with a Git Repository or exploring the way to work from a laptop that is not our normal's one or the developer prefered one.

There are times indeed when one is forced to use a computer in which one has not admin privilege or even having those, there is not time to set or configure an entire Development Enviroment such an IDE, configured with all plugins, libraries etc. It could be also useful when is not advisable to run code locally because either the hardware is not enough for the task done by the code base, or because we are to a client doing other projects and we want separate things but as set a virtual Machine or a Docker container is not worth the time.

Nevertheless software development never stop or sleep as can be done anytime and in any location especially nowadays with the "Cloud".

So this post is the first of a series on remote tools and solution and how to set them.

Nervertheless this first, will cover basic steos on how connect a local computer with Windows 10 for which we have only a simple User but could be applied to any OS.

It meant that we can still install software under that user account and have enough space for do it.

The following of this will cover the amazing possibilities offered by Visual Studio Online and further I wil test and write about the Visual Studio Remote Development .

Let's start, first install we have to install Visual Studio Code for Windows and MINGW64 that is the bash tool for Git on Windows and that use bash sintax.

Create an Azure account if you want use Visual Studio either locally or the Online version or later the Visual Studio Remote Development.

Once we have those, we need to decide with protocol to use, either SSH or HTTP(S), in order to connect, o our repositories(any). Its said that these steps can be done in some Companies by the DevOps/ SRE Team but as a developer you maybe need to be "adpating" be a good learning process and also is about a specific Repository and as a special case where reach out those team won't be effient or in case they are busy.

I write in advance that the connection via tunneling is subject to IT approval and I went only for it in order to explor the possibilities in order to have a clear and reproducible steps in case needed and the tunnelling connection is allowed by IT policies.

In general the SSH is a better way for the developer, as once setted it up will not require to provide in the future Git Remote operation ( pull, push, ect) credentials.

Instead the HTTP way do not require any approval as long as one has access to internet with the user because the protocol it use is already trackable by default by the IT enterprise. Also for out goal to work to some code from anyway, will suffice.

First step is to clone the Github repository (but this apply to any Git remote provider, so also Gitlab e.g), usually via http is something like :

 git clone https://github.com/User/YourRepo.git

Then you run the command, but unfortunately you get something like :

443_connectionRefused.PNG

This is highly happening because you are working behind an Enterpise proxy firewall.

To overcome it, and as we use HTTP protocol basically we need to tell Git how to use the same configuration that our browser use in order to let us reach outside websites.

You need to find your Proxy Server Name, usually this is under a file with the extention of .pac sometimes this easly to find from the broswer.

For example in Chrome it is under Settings, then "Open Proxy Settings"( I have a German Computer and Account, but that is basically the translation), it will open a System Window where it show where the Proxy Script is.

proxyScript.PNG

I have of course removed mine for privacy reasons, but is under Script Address

ProxScriptLocationt.PNG

This file can be open with any editor, Notepad or Notepad++ , it could be a very long one, you can skip all the line and go to the probably last line where it say

PROXY YourProxyAddress: Port

Take note of that address, and under your Windows Home User ( C:\Users\YourUser ), search for .gitconfig file, open it in an editor and you need to add under http tag(create it if is not there)

[http]
       # This is a comment, also add the sslverify, in order to not use any 
       # certificate
    sslverify = false 
    proxy = YourProxyAddress: Port

After these steps if we run again the clone command, we will be succefull cloned our remote repository :

RepoSuccessCloned.PNG.

This could have been achieved also by Git CLI withouth adding manually the proxy server address in .gitconfig, as explained here .

Or even better provide also the Git credential b CLI, as from here.

But in this way one could come to some issue, has happened to me because depending of the password some special caracthers for bash( as it is the Git CLI) need to be escaped such @ or !, personally I had some hard time doing that even I used the right encoding for those, moreover in this way Git store those into .gitconfig and may be not advisable store them in a computer that you don't use regulary or you are not the Admin Rights.

The first approach let you then provide your credential via CLI and also in Visual Sudio code via Terminal or Pallet if using a plugin, for the specific task(pull, push etc).

At this point you could be setted, but only if you are satisfied with the default account for Git that will be those of your User under you login in the machine.

In order to customize those, you need to tell git which account to use, the run the following in the [commands] (stackoverflow.com/questions/22844806/how-to..) :

git config --global user.email "you@example.com"
git config --global user.name "Your Name"
git config --global user.password "your password"

At this point you are all set as well with Visual Studio Code, if the Azure account is created( but will work with any CLOUD Service), for any Git task that can be done via HTTP.

VSCworking.PNG

As the post was longer as planned I will be a II Part regarding the SSH protocol and following regarding specifically VS Code Online and Visual Studio Remote development

No Comments Yet