0

I am trying to make some version control locally on my Android project. It is just to have control about my changes, but I do not want to upload them to any external repository. Neither I want to create infernal folders with dates of updates...

I would want to use Git, in which I am a bit familiar. I am also familiar with GitLab and GitKraken.

I have seen that there are some private repositories on GitLab but I guess you have to upload the code to an external repository.

My doubts are here, what are the differences in safety, when storing the code on my computer (with a version control system), compared to uploading to an external private repository? Does it have any legal effects to store my code in an external repository? It will be a public app in the future, but I do not want to share code (at least, by the moment). I want to keep all rights about it.

Also, if I use GitKraken I do not know if I can make commits to local repository without connecting it with a external (origin) repository because all examples I have seen uses one external repository as origin. Is it possible to make commits just having a local repository? Could I upload all my commits to an external private repository (if needed) in the future? I mean, all those commits that I have done in local repository.

To end, is it worth what I am trying to do? I mean, make all commits in local repository instead of a private exteral repository and, maybe upload them to an external private repository in the future (by the moment I am the only one who is going to develop the app but I do not know if in the future will be more people developing it).

I am starting with version control systems and never done it locally so any help would be appreciate.

2
  • 1
    It's called version control in English, not control-version. And that is exactly how Git works. In Git you are always working locally except when you type "git push" or "git pull".
    – user253751
    Feb 1, 2018 at 23:58
  • Git can be used locally, but you really should push to a repository outside the working directory. The .git folder in the working directory where all the git objects are stored is not particularly safe against mistyped commands. Feb 3, 2018 at 23:36

2 Answers 2

3

Git can be used 100% locally, without any servers. The value of using a Git hosting service is

  • that this allows multiple developers to collaborate more easily, and
  • the web interface, with features like issue trackers, pull requests, code search, …, and
  • integrations with other services you'd like to use.

It's also worth noting that using a remote repository protects against data loss when your local computer crashes. But it's not a backup, and won't help if you push a faulty commit history. It is still necessary to have your own backup strategy.

You mention security, and using a git hosting service does have potential security implications:

  • A misconfigured repository might accidentally be made public.
  • The hosting service may have an outage, impeding your work.
  • A malicious or compromised hosting service could manipulate or publish your repository.

Using a hosting service for non-public repositories has no legal effects beyond those in the contract between you and the hosting service.

If you have a local repository, it is possible without much effort to add a remote later.

# create a local repository called "foo"
$ git init foo

...
# connect a remote repository that's currently empty
$ git remote add origin URL

# push only the master branch
$ git push -u origin master

# push all branches and tags
$ git push -u --all origin
$ git push --tags origin

If there is a chance that a repository will be published, then at no point should secrets and confidential or sensitive information be committed. Even if you delete those files afterwards, they have become part of the commit history and can therefore be found and restored. Therefore, exclude configuration files etc. with a .gitignore, and don't put this info into files at all, if avoidable.

3
  • Thank you very much! Now it is more clear and it was exactly what I was looking for. Just one more question: origin is called the external repository, right? Not the locally one. Feb 3, 2018 at 11:43
  • @FranciscoRomero Yes, origin is the conventional name for the corresponding remote repository that you'll typically push to. But you are free to choose any name for a remote, and can even have multiple remotes. The "origin" repo doesn't have to exist first, so its name is a bit misleading in your case.
    – amon
    Feb 3, 2018 at 11:51
  • You are the best! Very clear and simple! Again, thank you! :) Feb 3, 2018 at 11:53
1

Git can be used locally, but you really should push major progress to a repository outside the working directory and preferably on a different disk/machine.

That is because the .git folder within the working directory where all the git objects and tracking data are by default stored is not particularly safe against the types of mistyped commands or system failures which could lead to the loss of the checked out files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.