I want to upload some parts of /etc/ towards gitlab. [Not the private keys]

What is the best way to do this with git?
My git knowledge is limited.
  1. Create a repo in gitlab
  2. Clone to your machine (it will give instructions to clone via ssh in the readme when you first create the repository)
  3. Add your files to the directory created by the clone
  4. git add *
  5. git commit -a -m "Your comment about this commit"
  6. git push
 
As a private project or for potential patches/merges to FreeBSD? It makes a difference.
If it is to merely keep some local changes for yourself, I would set up a local git repo on a standalone device (maybe usb drive) then simply push there.
 
  1. Create a repo in gitlab
  2. Clone to your machine (it will give instructions to clone via ssh in the readme when you first create the repository)
  3. Add your files to the directory created by the clone
  4. git add *
  5. git commit -a -m "Your comment about this commit"
  6. git push
"Add your files to the directory created by the clone."
When i do "copy" the originals are not tracked or followed when i do later "git push".
There must be a better way ?
 
"Add your files to the directory created by the clone."
When i do "copy" the originals are not tracked or followed when i do later "git push".
There must be a better way ?
They'll be tracked when you git add, you can add individual files and exclude what you don't want via .gitignore.
 
"Add your files to the directory created by the clone."
When i do "copy" the originals are not tracked or followed when i do later "git push".
There must be a better way ?

You generally have two ways of dealing with /etc files that live in a git tree (if you don't want to turn your /etc into a git checkout):
  • Symlinks
  • A `make install` in the git directory

The latter is a bit cleaner, and you can integrate daemon restarts and the like into the Makefile targets. Or build config files from m4.

Good luck.
 
Let's say i make on gitlab a repository "etc".
Let's say i clone this repository in the directory "/etc2".
I rename "/etc" to "/etc3"
I rename "/etc2" to "/etc".
I copy over all files "clone -i -v /etc3/ /etc/".
I remove "/etc3".
Then i perform in "/etc" individual "git add files".
And i do git push.
Would this procedure work ? A good or bad idea ?
[It's imperative i don't push private keys ...]
 
Too complicated. Just create a new repository in GitLab and follow the instructions to use an existing directory.

Pseudo code:

git init in /etc
add remote branch
add your ssh keys to .gitignore
git add .
git commit
git push

Edit: elgrande beat me to it.
 
What do you want to achieve? Is it just for having a backup or do you really need versioning of the files? Do you want others to have access?
 
I want to make public what is not confidential.
Like /etc/group.
And when i go to another computer i just can clone git pull the same configs as needed.
So gitlab as a form of backup remote & available from everywhere.
Offcourse i want the remote to be up to date with one command like "git push", when the underlying has changed.
 
Not only exclude the ssh keys. Also have a look at the .db files.
 
Cracauer what do you think of my approach i described ?

No, I don't like it.

I would have /etc/git/ and then a Makefile inside there that installs the files from /etc/git/ to /etc/, After checking them for conflict markers :)

Keep in mind that files might have extended attributes or require locking to change (e.g. via vipw).
 
Well if you only push when things are clean, you should be fine?

The problem with conflicts appears when you pull and you previously modified the files in another clone.

Or in other words: nothing ensures that the system is running on file versions that you deemed worth pushing.
 
I think privacy is of great importance. So when gitlab asked me my personal language i entered LATIN.
Thing is i cannot read LATIN.
 
Back
Top