Tag: clone

How to change the default local location for your Git repos in Team Explorer – 061

By default, Team Explorer sets your default location for your Git repos at \Users\<username>\Source\Repos, as seen in yesterday’s example

Local Git Repositories path in Team Explorer

If you want to change this location, perhaps to remove the Source directory from the path to save you a few extra clicks, you can go to Team Explorer – Settings

Team Explorer - Settings

and then click Git – Global Settings

Git - Global Settings

From there you can change the path.

updated default repository location

Notes:

  1. This change only affects new cloned projects moving forward. Your previously cloned repos will remain in their original directory.
  2. GitHub Desktop uses a different repo (\Users\<username>\Documents\GitHub) than Visual Studio. This change in Team Explorer doesn’t change the default location in GitHub Desktop. If you want both GitHub Desktop and Team Explorer to use same location, you’ll need to change the default location in GitHub Desktop as well.

How to clone your forked GitHub repository using via a command line interface – 040

It is time to get into coding examples from the command line!

In previous tips, you used either the Create new file or Edit file buttons on GitHub.com itself to make changes to a repo. Then you selected the Create a new branch for this commit option in either the Commit new file or Commit changes form to create a new branch (which will be used by a Pull Request).

In the upcoming days, you’ll see how to setup a branch in your local repo so you can submit a bug fix to the base repo as a Pull Request.

From your favorite Command line Interface (I’m using GitHub Desktop’s Git Shell that opens Git Bash – see yesterday’s tip), you’ll want to

  1. Clone the repo
  2. Create a branch (see tomorrow’s tip)
  3. Make your changes (see tomorrow’s tip)
  4. Push your branch back up to your GitHub repo (see the day after tomorrow’s tip)

But first, let’s clone the repo.

Go to the desired repo. For this example, I’m using saraford-tips/your-moment-of-github-zen

You can get the clone instructions from clicking the Clone or download dropdown button, and then coping the URL (either select the text inside the edit box or click the Copy to clipboard button).

Clone with HTTPS window showing URL

Now from the command line, run git clone <copied url>

image

Now cd into your repo, and you are all set locally! I always do a git status just out of habit.

showing git status from local cloned repo