{"id":631,"date":"2016-06-17T15:13:58","date_gmt":"2016-06-17T14:13:58","guid":{"rendered":"https:\/\/blogs.ncl.ac.uk\/isg\/?p=631"},"modified":"2016-06-17T15:13:58","modified_gmt":"2016-06-17T14:13:58","slug":"setting-up-a-visual-studio-team-services-git-repository","status":"publish","type":"post","link":"https:\/\/blogs.ncl.ac.uk\/isg\/?p=631","title":{"rendered":"Setting up a Visual Studio Team Services Git repository"},"content":{"rendered":"<p><strong>Creating a new repository in VSTS.<\/strong><\/p>\n<p>1. If you do not already have a VSTS project, you can create a new one from your team home page by clicking the New link under Recent Projects &amp; Teams (if you already have a project, skip to step 3):<\/p>\n<p><a href=\"https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-632\" src=\"https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/1-300x203.png\" alt=\"1\" width=\"300\" height=\"203\" srcset=\"https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/1-300x203.png 300w, https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/1-768x519.png 768w, https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/1-1024x693.png 1024w, https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/1-444x300.png 444w, https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/1.png 1029w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>2. On the Create new team project page, be sure to select Git as the Version Control option. This will automatically create you a Git repository with your new project:<\/p>\n<p><a href=\"https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-633\" src=\"https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/2-300x204.png\" alt=\"2\" width=\"300\" height=\"204\" srcset=\"https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/2-300x204.png 300w, https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/2-768x522.png 768w, https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/2-1024x696.png 1024w, https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/2-442x300.png 442w, https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/2.png 1029w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>3. In the Project home page, you can access your repository by clicking CODE:<\/p>\n<p><a href=\"https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-634\" src=\"https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/3-300x174.png\" alt=\"3\" width=\"300\" height=\"174\" srcset=\"https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/3-300x174.png 300w, https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/3-768x445.png 768w, https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/3-1024x594.png 1024w, https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/3-500x290.png 500w, https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/3.png 1237w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>4. If you wish to create a new repository (because you had an existing project without one, or because you wish to add an additional one to your project), you can click the drop-down at the top left and click New repository:<\/p>\n<p><a href=\"https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-635\" src=\"https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/4-300x173.png\" alt=\"4\" width=\"300\" height=\"173\" srcset=\"https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/4-300x173.png 300w, https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/4-768x442.png 768w, https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/4-1024x590.png 1024w, https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/4-500x288.png 500w, https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/4.png 1240w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><strong>Accessing the repository from your local computer.<\/strong><\/p>\n<p>First, you&#8217;ll need to install the git client; you can download the client from\u00a0<a href=\"https:\/\/git-scm.com\/downloads\">https:\/\/git-scm.com\/downloads<\/a>. The default installation options should be fine.<\/p>\n<p><strong>Cloning the repository using Visual Studio<\/strong><\/p>\n<p>If you&#8217;re using Visual Studio, you can clone the repository directly into it from the CODE page:<\/p>\n<p><a href=\"https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/11.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-642\" src=\"https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/11-283x300.png\" alt=\"11\" width=\"283\" height=\"300\" srcset=\"https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/11-283x300.png 283w, https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/11.png 668w\" sizes=\"auto, (max-width: 283px) 100vw, 283px\" \/><\/a><\/p>\n<p>This will open Visual Studio; your repository will be shown in the Team Explorer pane. Click Clone Repository:<\/p>\n<p><a href=\"https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-636\" src=\"https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/5-211x300.png\" alt=\"5\" width=\"211\" height=\"300\" srcset=\"https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/5-211x300.png 211w, https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/5.png 435w\" sizes=\"auto, (max-width: 211px) 100vw, 211px\" \/><\/a><\/p>\n<p>Then select a location to save your local copy of the repository, and click Clone:<\/p>\n<p><a href=\"https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/6.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-637\" src=\"https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/6-180x300.png\" alt=\"6\" width=\"180\" height=\"300\" srcset=\"https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/6-180x300.png 180w, https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/6.png 370w\" sizes=\"auto, (max-width: 180px) 100vw, 180px\" \/><\/a><\/p>\n<p><strong>Cloning the repository using the command line<\/strong><\/p>\n<p>If you wish to us a different editor, you can use the git command line tools to clone the repository. First,\u00a0copy the URL to the repository from the CODE page:<\/p>\n<p><a href=\"https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/7.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-638\" src=\"https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/7-279x300.png\" alt=\"7\" width=\"279\" height=\"300\" srcset=\"https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/7-279x300.png 279w, https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/7.png 666w\" sizes=\"auto, (max-width: 279px) 100vw, 279px\" \/><\/a><\/p>\n<p>Then:<\/p>\n<ol>\n<li>Open a PowerShell window.<\/li>\n<li>Create a directory for the local copy of the repository.<\/li>\n<li>Change directory to that directory.<\/li>\n<li>Type &#8216;git init&#8217; to initialise a local git repository.<\/li>\n<li>Type &#8216;git remote add origin &lt;Repository URL&gt;&#8217; to connect to the remote repository.<\/li>\n<\/ol>\n<p><a href=\"https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/10.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-641\" src=\"https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/10-300x124.png\" alt=\"10\" width=\"300\" height=\"124\" srcset=\"https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/10-300x124.png 300w, https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/10-768x316.png 768w, https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/10-500x206.png 500w, https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/10.png 993w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>You can now access the repository from any editor and manage it using command line tools (or any tools that the editor provides). If you wish to use Visual Studio Code, simply click File-&gt;Open Folder and point it at the folder. If the git pane looks as follows, it&#8217;s worked:<\/p>\n<p><a href=\"https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/9.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-640\" src=\"https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/9-300x125.png\" alt=\"9\" width=\"300\" height=\"125\" srcset=\"https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/9-300x125.png 300w, https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/9-768x321.png 768w, https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/9-500x209.png 500w, https:\/\/blogs.ncl.ac.uk\/isg\/files\/2016\/06\/9.png 976w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><strong>Next steps<\/strong><\/p>\n<p>Git is now connected to the remote repository and ready to use. A future blog post will give an overview of how git works, and what the common commands that you need to learn are.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Creating a new repository in VSTS. 1. If you do not already have a VSTS project, you can create a new one from your team home page by clicking the New link under Recent Projects &amp; Teams (if you already &hellip; <a href=\"https:\/\/blogs.ncl.ac.uk\/isg\/?p=631\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":4756,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29,19,36,39],"tags":[],"class_list":["post-631","post","type-post","status-publish","format-standard","hentry","category-cloud","category-community","category-devops","category-source-control"],"_links":{"self":[{"href":"https:\/\/blogs.ncl.ac.uk\/isg\/index.php?rest_route=\/wp\/v2\/posts\/631","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.ncl.ac.uk\/isg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.ncl.ac.uk\/isg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.ncl.ac.uk\/isg\/index.php?rest_route=\/wp\/v2\/users\/4756"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.ncl.ac.uk\/isg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=631"}],"version-history":[{"count":2,"href":"https:\/\/blogs.ncl.ac.uk\/isg\/index.php?rest_route=\/wp\/v2\/posts\/631\/revisions"}],"predecessor-version":[{"id":644,"href":"https:\/\/blogs.ncl.ac.uk\/isg\/index.php?rest_route=\/wp\/v2\/posts\/631\/revisions\/644"}],"wp:attachment":[{"href":"https:\/\/blogs.ncl.ac.uk\/isg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=631"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.ncl.ac.uk\/isg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=631"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.ncl.ac.uk\/isg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=631"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}