# Visual Studio - Git Create new repo in on-prem Azure Devops

### Create a new repo in the web portal and push code<span class="uJ19be notranslate" data-processed="true" data-wiz-uids="NJbQfc_k"><span class="vKEkVd" data-animation-atomic="" data-processed="true" data-wiz-attrbind="class=NJbQfc_j/TKHnVd"> </span></span>

#### <span class="uJ19be notranslate" data-processed="true" data-wiz-uids="NJbQfc_k">This is the standard approach for managing new code in Azure DevOps.<span class="uJ19be notranslate" data-processed="true" data-wiz-uids="NJbQfc_n"><span class="vKEkVd" data-animation-atomic="" data-processed="true" data-wiz-attrbind="class=NJbQfc_m/TKHnVd"> </span></span></span>

1. <span class="T286Pc" data-processed="true" data-sfc-cp="">**Navigate to your project:** Open the web portal for your Azure DevOps Server and select your project.</span>
2. <span class="T286Pc" data-processed="true" data-sfc-cp="">**Go to Repos:** In the left-hand navigation menu, select **Repos** &gt; **Files**.</span>
3. <span class="T286Pc" data-processed="true" data-sfc-cp="">**Create a new repository:** From the current repository drop-down menu at the top, select **New repository**.</span>
4. <span class="T286Pc" data-processed="true" data-sfc-cp="">**Configure the new repo:**</span>
    - <span class="T286Pc" data-processed="true" data-sfc-cp="">Verify that **Git** is the repository type.</span>
    - <span class="T286Pc" data-processed="true" data-sfc-cp="">Enter a **name** for your new repository.</span>
    - <span class="T286Pc" data-processed="true" data-sfc-cp="">Optionally, add a **README** file or a `.gitignore` file.</span>
5. <span class="T286Pc" data-processed="true" data-sfc-cp="">**Create:** Select **Create**. An empty Git repo is now ready in your project.</span>
6. <span class="T286Pc" data-processed="true" data-sfc-cp="">**Clone the repo locally:** Once the repo is created, an overview page will appear with a **Clone** button. Copy the provided clone URL.</span>
7. <span class="T286Pc" data-processed="true" data-sfc-cp="">**Open a command prompt** on your local machine and navigate to the folder containing your local code (if you have existing code).</span>
8. <span class="T286Pc" data-processed="true" data-sfc-cp="">**Connect your local repo to the remote:**</span>```bash
    git init
    git add .
    git commit -m 'initial commit'
    git branch -M main
    git remote add origin <clone URL>
    	git push -u origin main #May fail
    git pull --rebase origin main
    git push -u origin main
    ```
    
    
    - <span class="T286Pc" data-processed="true" data-sfc-cp="">Run `git remote add origin <clone URL>` means that you can use the clone URL from within Azure DevOps </span>
    - <span class="T286Pc" data-processed="true" data-sfc-cp="">Run `git push -u origin [master]` (or the name of your default branch) to push your local code to the newly created Azure DevOps repo.</span><span class="uJ19be notranslate" data-processed="true" data-wiz-uids="NJbQfc_21"><span class="vKEkVd" data-animation-atomic="" data-processed="true" data-wiz-attrbind="class=NJbQfc_20/TKHnVd"> </span></span>