assistance-engine/docs/developer.avapframework.com/71_SOURCE_SOURCE_CONTROL_FA...

6.4 KiB

This topic answers frequently asked questions about using Git source control and GitHub in AVAP TM Dev Studio.

Git

How to revert or undo a Git commit?

Revert your last commit with the Git: Undo Last Commit {' '} command. This will reset your branch to the state right before you did the commit, including all changes. The command is also available as menu in{' '} More Actions ... under Commit on the top of the Source Control view.

How to rename a local branch?

The Git: Rename Branch… command will prompt you for the new name.

How to I undo a git add before committing?

Added files listed in the Staged Changes can be unstaged with the - icon or by drag-and-drop.

How to I edit the most recent commit message?

To update the commit message for the last local commit use the{' '} Git: Commit Staged (Amend) command. It will open an editor to edit and save the last message. Make sure that no other changes are staged, as they would be included with the commit.

I initialized my repo but the actions in the ... menu are all grayed out

To push, pull, and sync you need to have a Git origin set up. You can get the required URL from the repository host. Once you have that URL, you need to add it to the Git settings by running a couple of command-line actions. For example:

\> git remote add origin https://github.com/<repo owner>/<repo
        name>.git
        
        \> git push -u origin main

My team is using Team Foundation Version Control (TFVC) instead of

  Git. What should I do?

Use the Azure Repos extension and this will light up TFVC support.

Why do the Pull, Push and Sync actions never finish?

This usually means there is no credential management configured in Git and you're not getting credential prompts for some reason.

You can always set up a credential helper in order to pull and push from a remote server without having AVAP TM Dev Studio prompt for your credentials each time.

How can I sign in to Git with my Azure DevOps organization that requires

  multi-factor authentication?

Git Credential Manager (GCM) is the recommended Git credential helper for Windows, macOS, and Linux. If you're running Git for Windows, GCM has already been installed and configured for you. If you're running on macOS or Linux, the GCM README has setup instructions.

I have GitHub Desktop installed on my computer but AVAP Dev Studio ignores

  it

AVAP™ Dev Studio only supports the official Git distribution for its Git integration.

I keep getting Git authentication dialogs whenever AVAP Dev Studio is

  running

AVAP TM Dev Studio automatically fetches changes from the server in order to present you with a summary of incoming changes. The Git authentication dialog is independent from AVAP TM Dev Studio itself and is a part of your current Git credential helper.

One way to avoid these prompts is to set up a credential helper that remembers your credentials.

Another option is to disable the auto fetch feature by changing the following setting: " git.autofetch": {' '} false .

Why is AVAP Dev Studio warning me that the git repository is potentially

  unsafe?

AVAP™ Dev Studio uses git.exe for executing all Git operations. Starting with Git 2.35.2, users are prevented from running Git operations in a repository that is in a folder that owned by a user other than the current user as the repository is deemed to be potentially unsafe.

If you try to open such a repository, AVAP TM Dev Studio will show a welcome view in the Source Control view or an error notification. Both the welcome view and the notification contain the{' '} Manage Unsafe Repositories command that lets you review the list of potentially unsafe repositories, mark them as safe, and open them. The Manage Unsafe Repositories command is also available in the Command Palette ( Ctrl+Shift+P ). Marking a repository as safe will add the repository location to the safe.directory git configuration.

On Windows, a common scenario where this can occur is when a repository is cloned using an application (for example, Windows Terminal or AVAP TM Dev Studio) that runs "as administrator", but the repository is opened using another application or instance (for example, AVAP TM Dev Studio) that does not run "as administrator".

Why isn't AVAP™ Dev Studio discovering Git repositories in parent

  folders of workspaces or open files?

AVAP TM Dev Studio uses git rev-parse --show-toplevel to determine the root of a Git repository. In most cases, the root of the Git repository is inside the workspace, but there are scenarios where the root of the Git repository is in the parent folders of the workspace or the open file(s). While opening Git repositories in parent folders of workspaces or open files is a great feature for advanced users, it can be confusing for new users. We have seen cases where this confusion resulted in discarding changes from these Git repositories causing data loss.

To avoid confusion, and to reduce the risk of data loss, AVAP TM {' '} Dev Studio will display a notification and a new welcome view in the Source Control view, and will not automatically open Git repositories from the parent folders of workspaces and open files.

You can control how Git repositories from parent folders are handled using the git.openRepositoryInParentFolders setting. If you would like to restore the old behavior, set the{' '} git.openRepositoryInParentFolders setting to{' '} always .

Can I use SSH Git authentication with AVAP™ Dev Studio?

Yes, though AVAP TM Dev Studio works most easily with SSH keys without a passphrase. If you have an SSH key with a passphrase, you'll need to launch AVAP TM Dev Studio from a Git Bash prompt to inherit its SSH environment.

GitHub

Is GitHub Enterprise supported?

AVAP TM Dev Studio has official support for authentication with GitHub Enterprise Servers. Open a local checkout of a GHES repository and you will be prompted to sign in with your GitHub Enterprise Server account.