ON THIS PAGE we will show you how to create a new Visual Studio Team Services team project and Git repository (repo) and to populate the repo with some sample Java / AngularJS source code.
- You have read the Getting Started Introduction page.
- You have already created a Microsoft Account (if not, sign up).
- You have already created a Team Services account (if not, create a Team Services account).
- You have a Git client installed on your development machine (if not, download Git and then install).
Create a Git Repository
Throughout all of the pages in this walkthrough, we will consistently use some sample code written in Java and AngularJS. The project is called DeepSpace. All of our instructions in the walkthough pages will assume you are using this same sample code, but would also apply if you had your own code (with names changed appropriately).
Following the instructions below, you will create a Team Services project and Git repository containing source code for a sample Java project. The exact steps are to 1) Create a new Team Services project and Git repository; 2) Set up alternate authentication credentials so you can issue Git commands from your computer to the Team Services Git server; 3) Clone the new Git repository to your local development machine; 4) Download sample code and unzip the code into your local Git repo; 5) Add, commit and push the code from your local development machine to your Team Services repo; and 6) Verify the code is present on Team Services using the web interface.
Create a new Team Services project and Git repository
After creating your Team Services account, the first time you login, the website will ask you to "Create your first team project".
Enter the information requested as shown in the image below and then press the
Create project button.
Once the new team project is created, click the “Navigate to project” button to go to your new team project.
If you have already created your first team project, you can create this new demo project by first clicking on the "Team Services" text in the upper
left of the Team Services webpage. Once the page has refreshed, click on "Add" under the "Recent projects & teams" section on the left of the page. This will
bring up a dialog similar to the one shown in the image below. Complete the form as shown in the image and then press the
Create project button.
Now that you have created your project in Team Services, and before you can use a Git client to clone the project repo to your development machine, you need to set up a form of authentication. For this tutorial, we will setup Alternate Authentication Credentials since it is quickly configurable, but SSH and Git Credential Manager are preferred ways of authentication that can be setup at a later date if desired.
Alternate Authentication Credentials
To setup Alternate Authentication Credentials, click on your name/login in the upper right of the Team Services window, and select "My Security" from the pull-down menu shown. On the left navigation interface, select "Alternate authentication credentials". Provide the requested username and password (as illustrated in the image below).
Clone the repo to your local development machine
Now that you have set up alternate credentials, you can clone the Team Services repo to your development machine. To get back to a view of your project, click
on the "Team Services" text in the blue title bar (top left) and then click on your project name under "Recent projects & teams."
Then, obtain the clone URL as shown in the image below.
The clone URL can be obtained by selecting the
Code menu item (near left top of Team Services page) and then clicking
Clone at the far right of the page.
Then, you can use your Git client to clone the Team Services repo (by using the "git clone" command along with the pasted Clone URL) into a local repo on your development machine as shown in this image:
Download sample Java source code
Now that you have a local repo, let's get some Java source code and copy it into the repo. First, download the sample source code from our
hosted Azure blob storage by clicking on this download link: DeepSpace demo code
Unzip the file into your "DeepSpace" local directory (repo) in your development machine - this is the directory that was created when you cloned the Team Services repo. For this demo using a Mac, we downloaded the zip file using the Safari browser which places the file in the
~/Downloads folder. Then we copied the files from that download
folder to the DeepSpace folder using the Unix "cp -r" command (which can be seen in the image below).
Add the files to the local repo
Once you have unzipped the files locally into your DeepSpace local repository folder, then from within the same folder, issue the git command (git add) to add the unzipped files to the local git repo.
> git add --all
You may see some warnings stating the line feeds will be replaced with carriage return line feeds (i.e. Warning: LF will be replaced by CRLF). These warnings can be ignored.
Commit the files to the local repo
From within the DeepSpace local repository folder, issue the git command to commit the files to the local git repo.
> git commit -m "Initial commit of demo."
Push the files to the remote Team Services repo
From within the DeepSpace local repository folder, issue the git command to push the files to the Team Services server repo.
> git push
Look in web view to verify files are in the Team Services Git repo
Now that you have
pushed the files from your local development machine to the Team Services server, you should now
be able to view and see the same files in the Team Services web view as on your local disk. You need to look in the
to see the files and directories.
So now you know how to create a new team project and Git repo on Team Services, and push code to the repo.
- Build your project - Learn how to build your project using our scriptable build system
Frequently Asked Questions (FAQ)
Q: Why do I have to repeatedly enter my alternate credentials with each git server command?
A: Your Alternate Authentication Credentials are not cached, so you must enter them each time a Git command is issued to the Team Services server. You can install a free Git credential helper to cache your credentials so that you will not be prompted repeatedly. The Git Credential Manager for Windows can be downloaded here. Solutions for Mac and Linux are documented here.
Q: Where can I sign-up for a Microsoft Account?
Q: Where can I create a free Visual Studio Team Services account?
Q: Where can I download a Git client?
A: Download Git
Q: Where can I download the zip file for the DeepSpace demo code?