How to Do Read Only on Visual Studios 2017
In that location's nothing wrong with using divide tools to perform those related activities. Only, wouldn't it exist efficient if all your needed actions can exist performed without leaving your IDE?
Not a reader? Lookout man this related video.
In this article, you will learn the basic Visual Studio Code GitHub setup. And then, you will be able to perform the typical Git actions like clone, phase, commit, and push, all while staying within the Visual Studio Lawmaking awarding.
Prerequisites
If you programme to follow along with this walkthrough, you need to meet some requirements equally follows.
- A Windows 10 computer. The version used in this article is 1909, just this article is not specific to whatsoever version.
- Visual Studio Code. As of this writing, the electric current version is ane.47.two.
- A GitHub account with a repository to work with.
The Git Extension
To become your Visual Studio Code GitHub setup working, yous'll need to work with Git. Visual Studio Code comes installed with a built-in extension for source command using Git. At that place are many configurations available with the Git extension. Still, the default settings are already right as they are out of the box.
Still, in that location are some configuration changes with the Git extension that you lot may desire to alter as a matter of preference. But before you do, you'll demand to know where to find the Git extension settings. Can't modify something when you can't observe it, yep?
To open the settings using the menu, click on File —> Preferences —> Settings. Or you tin can besides press CTRL+,
shortcut.
![Visual Studio Code GitHub setup settings menu item](https://adamtheautomator.com/wp-content/uploads/2020/07/Untitled-21.png)
Then, in the Settings tab, click Extensions —> Git. You lot should then see the list of configuration items for the Git extension, every bit shown below.
![Git extension settings](https://adamtheautomator.com/wp-content/uploads/2020/07/Untitled-1-2.png)
At present, this commodity does not cover every configuration item for Git. Still, they are mostly self-explanatory, especially if you're already familiar with working with source control.
Making Sure Git Is Installed
"What? I thought Git is already congenital-in?".
Well, the Git extension is built-in, but the Git program is not. The extension, as the name implies, is merely meant to "extend" VS Code to integrate with Git. Information technology tin can be disruptive, and if it is for y'all, you lot may want to read up on What is Git offset to have a amend understanding.
To determine if GIt is installed and detected by the Git extension, click on the Source Control button or press CTRL+SHIFT+M
while inside the VS Code window. If Git is non installed or detected, you lot would see a message, similar to the one below.
![Git is not installed or selected](https://adamtheautomator.com/wp-content/uploads/2020/07/Untitled-2-2.png)
Every bit you can see from the epitome above, in the Output pane, in that location are standard paths where VS Code tries to await for a valid Git binary installation. This situation means that you either have to install Git first or maybe Git is installed simply in a path that is non recognized past VS Lawmaking.
If Git is Installed But in a Non-Standard Path
If Git is installed in a non-standard path, you tin can fix that past irresolute the Path value in the Git extension setting, as you lot tin can refer to below.
![Git extension settings](https://adamtheautomator.com/wp-content/uploads/2020/07/Untitled-3-2.png)
When you click on the Edit in settings.json link, the file will exist opened in VS Code. Run into the screenshot below for reference. The value of the git.path must be changed to point to the correct path where the Git binary is installed. Then, save the settings afterward modification.
![Change the git.path value in the settings.json file](https://adamtheautomator.com/wp-content/uploads/2020/07/Untitled-4-3.png)
If Git is Non Installed
Needless to say, if Git is not installed, you lot need to install it. You can do and then past downloading the installation file from this link —> https://git-scm.com/.
One time you've downloaded the file, follow the sit-in below on how to install Git with default options. The installation is straightforward, and in that location is no need to change the default options for this article. You'll be well on your style to finishing your Visual Studio Code GitHub setup.
![Installing Git](https://adamtheautomator.com/wp-content/uploads/2020/07/install-git-2.gif)
After you're done installing Git, restart Visual Studio Lawmaking and confirm that the Git is now detected. The screenshot below shows what you'd expect to see if Git is detected.
![Git is installed and detected](https://adamtheautomator.com/wp-content/uploads/2020/07/Untitled-5-2.png)
Cloning a GitHub Repository
Now that you've completed the initial steps to ensure that VS Code works with GitHub, it is time to put it into action and confirm that you've done so far is correct. The fastest mode to examination is by cloning an existing repository in your GitHub account.
In this case, a individual repository named junecastillote/demo will be used. You can use your repository for this instead. On the off hazard that you exercise not have a repository yet, delight refer to the Creating a new repository doc in GitHub to learn how to create one.
Follow the process below on how to clone a GitHub repository in VS Code.
First, click the Source Control view push or press the keyboard shortcut CTRL+SHIFT+G
. Next, click the Clone Repository button. Then, click on Clone from GitHub, and you lot will be prompted to permit a sign-in endeavour. Click on Allow.
![Initiate cloning of a GitHub repository](https://adamtheautomator.com/wp-content/uploads/2020/07/Untitled-6-2.png)
The authorization page will automatically launch in your default web browser. Click on the Keep button.
![Authorize VS Code access](https://adamtheautomator.com/wp-content/uploads/2020/07/Untitled-7-2.png)
The next page shows you lot the permission request details. To proceed in giving VS Lawmaking the required permissions, click on the Authorize GitHub button.
![VS Code permission request](https://adamtheautomator.com/wp-content/uploads/2020/07/Untitled-8-2.png)
When authorization is washed, you will go a status page similar to the i shown below. If prompted that the site is trying to open Visual Studio Code, click Open.
![VS Code authorization successful](https://adamtheautomator.com/wp-content/uploads/2020/07/Untitled-9-2.png)
One time you lot're back in the VS Lawmaking window, you can either search of the repository name or select the repository name that you lot intend to clone. In the example below, the repository name junecastillote/demo was searched and then selected.
Subsequently selecting the repository to clone, yous will be asked to provide the binder where the repository will be saved locally on your reckoner. Specify the destination folder and click on Select Repository Location.
![Cloning a GitHub repository](https://adamtheautomator.com/wp-content/uploads/2020/07/Untitled-10-1.png)
Notation: GitHub log in will be triggered when performing actions that crave authentication. Such actions include cloning from a private repository or pushing to a repository
The GitHub Login window volition popular up, and you lot need to enter your GitHub credentials to log in.
![Log in with GitHub account](https://adamtheautomator.com/wp-content/uploads/2020/07/Untitled-11-1.png)
After completing the login, VS Lawmaking will keep to clone the remote repository to your computer. One time the cloning is done, you would go a notification at the lesser right of the VS Lawmaking window, as you can see from the screenshot below. Now, you can click either Open or Open up in New Window depending on your preference.
![Repository cloning is complete](https://adamtheautomator.com/wp-content/uploads/2020/07/Untitled-12-1.png)
As you can see from the screenshot below, the contents of the cloned GitHub repository is now loaded in VS Code. At this betoken, you can start making changes to your repository.
![The local repository is loaded in VS Code](https://adamtheautomator.com/wp-content/uploads/2020/07/Untitled-13-1.png)
Staging, Committing and Pushing Changes to GitHub
Continuing on with your Visual Studio Lawmaking GitHub setup, at this bespeak, VS Code is already setup to employ Git and work with your GitHub repository. Besides, a repository has been cloned in the previous section, which indicates all is working. However, y'all're not washed yet.
Side by side is to determine whether your changes to your cloned repository can be successfully pushed to your remote GitHub repository.
Adding and Modifying Files
Using the cloned repository in the previous section, the file README.Doc is edited, equally you tin see below, to add a new line.
![File content is modified](https://adamtheautomator.com/wp-content/uploads/2020/07/Untitled-14-1.png)
Side by side, to add a new file to the workspace, press CTRL+North
or go to File —> New File. In this example, the new file is named demo.ps1. Edit the file to add content to it then save it.
You lot would see that the new file you created volition be marked with a U, which ways untracked. Refer to the example screenshot beneath.
Untracked files are any files in your working directory that were not in your concluding snapshot and are not in your staging area. Reference: two.2 Git Basics – Recording Changes to the Repository
![New file added to the workspace is untracked](https://adamtheautomator.com/wp-content/uploads/2020/07/Untitled-15-1.png)
Reviewing and Staging Changes
To look at and review the changes, get to the Source Control view. You lot should see that the two changes are needed to be reviewed. As you lot tin encounter from the image below, clicking on each of the changes volition open comparison of the original contents of the file and the proposed changes in information technology.
![Diff view of the original and changed contents of the file](https://adamtheautomator.com/wp-content/uploads/2020/07/Untitled-16-1.png)
Later on reviewing, yous are expected to either discard or stage the changes to the files.
You accept the pick to discard or stage the changes of each file. By clicking on the discard (↶) or the phase (+) sign adjacent to the filename.
You can likewise phase or discard all changes at once past clicking on the More actions (…) button and selecting either the Stage All Changes or Discard All Changes carte items. In this example, all changes will be staged.
![Buttons and menu to stage or discard changes](https://adamtheautomator.com/wp-content/uploads/2020/07/Untitled-17-1.png)
Committing Changes
Now that the changes have been staged, the next action is to commit the changes to the local repository. This step comes before pushing the changes to the remote GitHub repository.
To commit the changes, you must include a meaningful bulletin to the commit. Like the case below, type in the message that you lot want to include in the commit. Once you're satisfied with your message, press CTRL+ENTER
or click the commit (✓) button to finish saving the changed to the local repository.
![Commit changes to the local repository](https://adamtheautomator.com/wp-content/uploads/2020/07/Untitled-18-1.png)
Pushing Changes to GitHub
After the changes are saved to the local repository, the Source Command view should reflect that the number of changes has reset to zilch (0).
To finally push the changes in the local repository to remote repository in GitHub, click on the More than actions (…) button and so click on Push button.
![Pushing the local repository changes to GitHub](https://adamtheautomator.com/wp-content/uploads/2020/07/Untitled-19-1.png)
Lastly, if yous wish to confirm that the changes were pushed to GitHub, you can visit your GitHub repository and look for the final update details. As you can see below, the message or description of the files is the same every bit the bulletin that was added to the commit before pushing the repository dorsum to GitHub.
![Local repository successfully pushed to GitHub](https://adamtheautomator.com/wp-content/uploads/2020/07/Untitled-20-1.png)
Extending VS Lawmaking Git with the GitHub Extension
If you've completed all the previous steps, then VS Lawmaking can already be used to work on your GitHub repositories. But GitHub integration can be farther expanded by installing the GitHub Pull Requests and Bug extension. The said extension will add features such as the ability to review and manage pull requests and issues direct in VS Lawmaking, amidst others.
To install the extension, go to the Extensions view. Then in the search box, enter the search term "GitHub Pull Requests and Issues". When the extension page is displayed, click on the Install button to install it. Refer to the demonstration beneath.
![Installing the extension from search](https://adamtheautomator.com/wp-content/uploads/2020/07/install-extension1-1.gif)
Some other style you can install the extension is past command line. Get-go, copy the command beneath and run in the VS Code terminal to install the extension.
code --install-extension GitHub.vscode-pull-request-github
Once the control above has completed, yous may need to reload your VS Lawmaking window for the extension to be activated.
To reload the VS Lawmaking window, press CTRL+SHIFT+P
to bring upwardly the command palette. Then type in reload window
and printing enter, and the VS Code window volition exist reloaded. You can refer to the install process demo below.
![Installing the extension from search](https://adamtheautomator.com/wp-content/uploads/2020/07/install-extension2-1.gif)
Summary
Visual Studio Lawmaking is a feature-rich application where different functionalities converge and integrate with the use of various extensions. The Git extension that comes with VS Code allows developers to utilize a single interface to perform code editing, staging, committing and pushing changes to a remote repository such as GitHub.
In this case, you learned how to set up VS Code and Git to piece of work with GitHub. You lot've learned how to perform various Git actions inside VS Code such every bit clone, stage, commit and push.
The cognition covered in this commodity simply pertains to the nuts of using VS Code with GitHub. As yous're already aware, VS Lawmaking's GitHub integration can be further expanded past installing extensions.
Where y'all're set up to larn more, ane of the things you lot tin can exam is using VS Code to review and manage problems or even merge pull requests in GitHub all inside the VS Code application.
Cheers for reading!
Further Reading
- How To Stage Commits And Push To Github With Visual Studio Code (Video)
- What is Git ?
- VSCode Snippets: Speed up Coding with Shortcuts
How to Do Read Only on Visual Studios 2017
Source: https://adamtheautomator.com/visual-studio-code-github-setup/
0 Response to "How to Do Read Only on Visual Studios 2017"
Post a Comment