2

I started working at a company that uses a complex version control software, and the project I am working on is a standalone utility, unrelated to any existing codebase. I would like to use github for local version control because it is just hands down the best. The only issue is the policy is no company ip can be on any non company machine. so I cannot push to github servers. I have used github on a local branch before, however it still had the remote origin on github. Is there a way to setup the entire repo locally? I understand there would be no backup, I mainly need it for branch tracking, diff, and potentially revert commits if something goes wrong.

Justin Olson
  • 126
  • 2
  • 13
  • 8
    You appear to be confusing *git* and *GitHub*; you can certainly use the former without the latter. – jonrsharpe May 26 '16 at 21:43
  • 1
    See [this answer](http://stackoverflow.com/a/11820206/366335) for differentiation between git and GitHub. – Bryan May 26 '16 at 21:45
  • Yes just use git. Git is responsible for the version control and is, as they say "always local". GitHub is just a service that uses git. – Usagi May 26 '16 at 21:48
  • Github is just one of many companies that offer hosting of Git repos. Why would you need to upload anything there? Git can be used perfectly with local shared repositories. – C14L May 26 '16 at 21:54
  • You can run a git server on your localhost: [How to set up a git repository locally](https://linuxprograms.wordpress.com/2010/05/10/how-to-set-up-a-git-repository-locally/). And if you are interested in using some fancy GUI/web access you can also consider [GitLab](https://about.gitlab.com/), just ask your company IT guys to provide you appropriate support. Using SCM during development is highly recommended, so keep it on! – iksajotien May 26 '16 at 22:16
  • GitHub? That's that startup that's based on disrupting the industry of ... understanding of WTF git is. – Kaz May 26 '16 at 23:14

1 Answers1

2

Yes you can use git for local repositories only (avoiding GitHub altogether). To create a git repository (with no origin, or connections to anything external) The repository will be created in /.git

cd <mycodedirectory>
git init

To add files to the repository including all the .c and .h files

git add <file1> <file2> *.c *.h
git commit -m"starting commit"

From here you can use all the git commands as normal. See these general helps

git help
git help -a 
git help -g
Gregg
  • 2,444
  • 1
  • 12
  • 21