Navigation Menu

Skip to content

Git plugin v2

Twarit Waikar edited this page Aug 24, 2022 · 13 revisions

Prerequisites

$ git config --global user.name "your name"
$ git config --global user.email your@email.com

Installation

You can install this plugin from the Godot Asset Library here or you can use the manual process mentioned below.

  1. Download the latest release.

  2. Windows users should ensure they have the VC 2019 redistributable runtime installed.

  3. MacOS users may need to perform a one-time workaround as described here to be able to load the plugin in Godot.

  4. Extract the .zip contents under the res://addons/ directory of your Godot project. Please ensure that the plugin does not get extracted inside res://addons/godot-git-plugin-vx.x.x/godot-git-plugin, the plugin requires itself to be kept at res://addons/godot-git-plugin.

  5. Open your project using the Godot Project manager.

Usage

When the project loads up, you are greeted with the Godot editor that you know and love. However, you now have the option to set up a VCS plugin from the editor.

  1. Open Project > Version Control. Select Set Up Version Control.

  1. A popup will ask you which VCS plugin would you like to use. In our case we are using Git, so select GitAPI from the drop-down menu. Then click Initialize, and optionally enter your remote details to use the network features of this plugin, and then click Apply. The .gitignore and .gitattributes files that this plugin will automatically create are picked up from here.

If you are not able to see a GitAPI option then check if you copied the correct folder to res://addons/ according to the installation instructions.

Features

Git plugin provides the Godot editor with the backend hooks to:

  • View diffs for files and commits in Git. Both unified and split views are supported by the Godot editor.

  • Stage and unstage files. Double click the file names to move them from the staged to the unstaged area or vice-versa.

  • Commit changes to Git

  • Branches, use multiple remotes and push/pull/fetch new changes to a Git remote (e.g. a Github repository) with HTTPS or SSH transport. Performing network operations may freeze the editor till the network operation is complete, so you can watch the console logs to view their progress.

  • Commit history along with author and other metadata

FAQs

Why isn't my remote password/SSH passphrase getting saved in the editor?

Currently, the Godot Editor will not save your passwords locally on disk to avoid exposing your passwords to malicious parties. All other remote login settings will be retained.

How to setup network features of this plugin?

After initializing the plugin, enter the remote login settings and hit Apply. You may want to ensure that your SSH public/private key files are having the appropriate permissions for this plugin to be able to load them in.

If you are using Github, HTTPS passwords will not work and they will need to be replaced with a Github PAT linked to your Github account. More information on creating a Github PAT is here.

Open the Commit tab and create a new remote with the SSH endpoint to your Git remote. It should look like the image below.

Note the git@github.com:<organization>/<repository>.git format in the remote URL.

Now Godot should use your specified credentials while pushing new commits to this remote.

Clone this wiki locally