Gitkraken workflow: how to Init local and remote?

Viewed 6906

I'm a new user of Gitkraken, and there's one piece of the workflow that I can't readily figure out from the documentation:

  • I have a programming project that has never before had a repository
  • I want to create a local repository for it, in the directory I'm already using
  • At the same time, I want to create a remote repository on Bitbucket.org, properly connected so that the "push" and "pull" buttons work.

Creating the local was easy enough, but "add remote" got me a strange error message, "no match". I don't understand this "add remote" command very well: can it CREATE a repository on the remote site, or does it merely ATTACH to one that must already be there? I overcame this error by creating it via browser and using "git add remote" at the terminal, but that's clunky and I'd like to do better.

I also tried to do this by using the Gitkraken File > Init command with the "also clone" checkbox checked, but this got me the error message, "the directory already exists and it isn't empty." No, Gitkraken, you got this wrong! I didn't want to CLONE the new (empty) remote repository into something local, I wanted to COPY my new local repository into it. Reverse operation!

So what is the best workflow for creating a local and an associated remote for a project being newly incorporated into Git version control?

3 Answers

Trying to open a repository to work with an existing project that does not have a repository did not work for me. I found the easiest way to insert an existing project to GitKraken was to "init" a new repository and then copy the existing files to it.

Creating a empty remote repository

Generally it's easiest to create the repository at the beginning of your project. Chose remote when you init the repo, and it will create the remote repository for you wherever you pick (GitHub, Bitbucket, etc.). It will then also create a local repository for you. The both are connected and you can easily interact with local and remote from there.

Initializing a existing project into a remote repository

If you've already got some project that has no version control, the easiest way is to:

  1. choose the "Init" option and select create repository in your folders parent directory.
  2. Name the repository in Gitkraken the exact same name as your existing folder.
  3. Gitkraken will then initialize the local repository within your existing code project.

If you then want to make it into a remote repository as well, you select the push option in the repository menu bar. Then you can select your provider (Bitbucket, GitHub, etc.) and GitKraken will create the remote repository for you.

(Creating an empty repository as described by @IvarsB and then copying everything into it is theoretically also a viable option. However it takes longer and you must be careful that you don't forget any hidden files! (like .env, .htaccess, etc.) which might be hidden by your operating systems file explorer.

Related