Thursday, May 18, 2023

Simple Command Line Code to Create Remote Git Repo

 

Git is great for programmers

VSS 6.0
I remember the days of VSS.  A great tool for a solo programmer, but it wasn't very scalable for a large team.  I am not sure I even ever used it in a team.  It was a great tool for me at the time, and it did help me a few times to go back to code that did work before.  Thankfully, Linus Torvalds created Git in 2005.  Then GitHub, GitLab, and Microsoft bought it all in 2018. (source)

It is hard to even get some jobs without a GitHub account.  That is a bit unreasonable, since 99% of my GitHub projects are private.  Private projects don't even show as green dots on your profile.  I don't feel that is a fair assessment of your programming skills.  I digress.

Git Logo
With GitHub being so easy to use and integrated into the programming community, why would I want to have my own local Git Server?  Well, because I like to play with technology, and see what I can do.  It also keeps my code more private than GitHub can.  AI can't use my code for learning, which is a benefit for everyone.  

I really enjoy having my own Git Server on my NAS, however, creating a new repo is quite a bit more cumbersome than it is on GitHub.  However, creating a new Git Repo on a Synology NAS server with the Git Server installed isn't as easy as it is on git hub.  Here is what you have to do to create an empty repo on a standard Git Server with SSH:
  • SSH into the server (type in your hard password)
  • change to the proper directory
  • then run the git init command for your new repo
Why would I want to do that?  That would deter me from using my local NAS for this.  So, what do I do?  I created a console app that I can run from the command line to do all that for me!  Instead of doing all of that typing, I have one command I run:
  • GitSSH --repo my-new-repo
That is it!  I set the server, login, and git directory in my configuration file, so I don't have to type any of that in there.  It is so much easier for me to do that.  It is even easier than creating an empty repo in GitHub!  

The net effect is about the same as having all my projects set as private in GitHub.  Except it is even less likely that a hack will get to my code, or that my code is used to train AI.  Trust me, you don't want that.  LOL.

I also like the fact that I am not susceptible to any user license changes GitHub my throw at me.  I don't expect that to be an issue, but I like to keep my options open.

I made the app so that you don't have to store anything in a config file.  It will accept different arguments, or it will prompt if there is information it needs and wasn't provided.  If this is something you are interested in, check out the details on Git-SSH.  You can also download it from here.

I have not made the source code public, as I had accidentally put the config file in the project at one point with my information in there.  So, that code shall remain on my server :).

Let me know your thoughts on the app.  Have a wonderful day!

Coder B

No comments:

Post a Comment

Thank you for commenting! I am thrilled you even considered commenting at all :)