Frage

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.

War es hilfreich?

Lösung

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.

Andere Tipps

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
scroll top