Johnathan Elmore
Johnathan Elmore

Reputation: 2244

How can I clone a non-github hosted repository using Github Desktop

How can I clone a non-github repository using Github Desktop?

https://local-git-service/some-user/some-repo.git

If I have an existing repository initialized, I can add it using Github Desktop. But how can I clone it without using the git command?

Our team uses an internal Gogs site to manage our repositories, and we would like to allow users to clone the repository without using command line tools.

Upvotes: 6

Views: 5570

Answers (3)

Roden Luo
Roden Luo

Reputation: 366

Clone repository

  1. Create a repository (don't need to follow remote name, use any name).
  2. Add remote to the repository settings. (Mac: Repository > Repository Settings; Win: "Gear icon" > "Repository Settings" > "Remote"; USE HTTP/HTTPS ADDRESS. Because SSH authentication requires you use command line for once. I mentioned in the third part of this answer.)
  3. Permanently delete the repository folder!
  4. (For Mac GitHub Desktop only) Click Publish once on the upper-right corner. This will not change the remote repository at all FOR NOW. This behavior may change in the later release of GitHub Desktop. This step is crucial because otherwise, you won't be able to see the Clone Again option in step 5. But Windows users do not need to do this.
  5. Go back to GitHub Desktop, Click Clone Again. It will prompt you to type login information.
  6. That's it. Enjoy Git, GitHub Desktop, Gogs!

(Please make sure you type the login information CORRECTLY if you want to click remember password so that you don't need to type it again and again. Because I happened to type it wrongly on Mac for the second test, and I have not found a place to change that. So I guess I need to re-install GitHub Desktop to correct it. I may be also going to write to GitHub for an answer. Will update this section if I get an answer. But as long as you type it correctly, it works perfectly.)


Tested on

Mac OS 10.10; GitHub Desktop, Deer Types (222), Latest version as of writing.

Win 10 Enterprise; GitHub Desktop, Chocolate-Covered Yaks (3.3.3.0) bc4735a, Latest version as of writing.



This step is for people who would like to use SSH connection. Requires the usage of command line, but it's once for all. (This step is what I think one must do if s/he is going to use SSH connection.)

Add SSH Key

For Mac:

Open GitHub Desktop, Press Command+T ( Or click "Repository>Open in Terminal")

Type: cat ~/.ssh/id_rsa.pub and press enter

Copy paste the output to your Gogs SSH Keys List.

One may have a different name for id_rsa.pub. (Seems there is an order for the keys that GitHub Desktop use to connect to remote server. I tried to use github's public key, failed. I didn't spend much time to figure out it. Just use id_rsa.pub.)

For Win:

Pretty much the same. But open the terminal by clicking the "Gear icon" on the top-right corner > open in Git Shell. Copy paste the ~/.ssh/github_rsa.pub file content instead.

Upvotes: 3

arq
arq

Reputation: 125

According to Github guides, Github Desktop provides only adding local repositories, see Adding a repository from your local computer to GitHub Desktop

On the other hand, older Github for Windows can be used with non-Github repositories, according to Haacked.com - Using Github for Windows with non-Github repositories . You could test the suggested drag and drop method on Github Desktop too.

Upvotes: 1

Johnathan Elmore
Johnathan Elmore

Reputation: 2244

For Mac

Github Desktop understands the github-mac://openRepo URL format/protocol.

For instance: github-mac://openRepo/http://somegitservice.local/some-user/my-repo

If you enter a link with that format into your browser's address bar, it should prompt you to open it with Github Desktop. This will not work if you do not have Github Desktop installed.

For Windows

I'm not sure! Until Github provides a similar solution, command line or another tool must be used to clone the repository to your Desktop. Once it's cloned to your desktop you can add it to Github Desktop using the + > Add button in the top-left of the window.

Upvotes: 3

Related Questions