Work with Git
This guide shows you how to start a chat in a Git repository, and how to pull, commit, and push from Knowledge Worker Agent.
Start a chat in a repository
Clone a repository
-
Under the message box, select Add context (+), then Connect GitHub repository.The Connect a repository dialog opens.
-
Under Repository URL, enter the repository's HTTPS address, for example
https://github.com/owner/repo.git. -
Select Clone.
A new chat starts, working in the cloned repository. Only the latest commit is downloaded.
If your workspace can't clone from that host, the dialog says why:
-
Your workspace has no token for that host: connect the provider in SecurSpaces under Profile → Integrations, then select Try again. The dialog links to that page.
-
Your workspace can clone only the repositories added to it: add the repository to the workspace in SecurSpaces, then try again.
Use a repository that's already in your workspace
-
Under the message box, select Add context (+), then Connect GitHub repository.
-
Under In your workspace, select the repository.
A new chat starts in that repository. If you just added one, select Re-scan to update the list.
Use an existing folder
-
Under the message box, select Add context (+), then Use existing folder.
-
Browse to the folder.
-
Select Use this folder.
A new chat starts that works directly in that folder.
The folder must be in your home folder. Hidden folders directly in it, such as
.ssh, aren't shown. A mount point outside the home folder, such as /mnt/shared-data, can't be used, even through a link from the home folder.
These options aren't shown in a project chat, because project chats use the project's folder.
See the repository's state
When a chat's folder is a Git repository, a row under the chat's name shows:
-
The branch name. A dot after it means there are uncommitted changes.
-
↓ with a number: how many commits you're behind.
-
↑ with a number: how many commits you're ahead.
Pull or push
At the top of the chat, select ⬇ Pull or ⬆ Push. The Git output that appears shows the result. Select Dismiss (✕) to close it.
Pull only fast-forwards. It doesn't merge. Both buttons are unavailable when the repository has no remote.
Git never asks for a user name or password here. If the remote needs credentials that the workspace doesn't have, the Git output shows an error. Set up your Git provider in SecurSpaces, then try again.
Commit changes
-
At the top of the chat, select ✓ Commit…, or select the branch name.The Source Control dialog lists the changes.
-
Enter a commit message.
-
Select ✓ Commit, or ⇡ Commit & Push to push as well.
All changes are committed, including new files.
Open the folder in VS Code
In a SecurSpaces workspace, select More actions (⋯) at the top of the chat, and then Open folder in VS Code. The chat's folder opens in VS Code in a new tab.
Connect a GitHub token for pull requests
To let the assistant work with GitHub pull requests and repositories through the GitHub connector, add a personal access token:
-
At the bottom of the sidebar, select Settings (the gear icon), then Accounts.
-
Under GitHub (PRs & repos), select Add token.
-
Paste a token into the field. Use a classic token with the
reposcope, or a fine-grained token with Pull requests and Contents: read access. -
Select Save.
The row shows Ready when the token works. Signing in to GitHub Copilot isn't enough for pull requests, because that sign-in can't read them.