Etckeeper + git and remote server - linux

Is it some possible to clone etckeeper git repo on my computer, make some changes and after that push to /etc folder on server?
I tried this but i have problem with push because etc is noa a bare repo.
Thanks for help.
BR,

You would have to either pull repo on etckeeper machine from your computed, or use intermediate bare repo like that:
your pc --(push)--> remote repo
etckeeper machine <--(pull)-- remote repo

With keepconf tool you can get the files from remote servers and track them locally into a git repo.

Related

Sync directory with git repo on new commit

How can I sync a directory with a git repo? When there are new commits to the repo I want the directory aswell. The process should be fully automated.
The git repo is a laravel installation, we're working on this installation with multiple devs, we would like to see our commits live. So thats why I have this problem.
I want to do this in CentOS 7 and Gitlab as my git host.

How do I clone a git repository located on my Mac connected to the internet?

I have an up-to-date git repo that I started on my MacBook. The project that I am working on is required to work on my university's Linux workstations that I can login to remotely via SSH. I've cded to the directory that I want to clone to on the workstation. I just have no idea how to get the SSH address for the repo on my MacBook when its connected to the internet. Also, how would this stay consistent considering I get a different IP every time I reconnect or go somewhere? Is what I'm doing even possible or a good idea?
One simple solution is to create an empty repository using a free github.com or bitbucket.org account. Using github for this example, you would then have a URL for the repo such as:
https://github.com/username/repo-name.git
Then, simply push the contents of your local repo up to the newly created online repo like so:
$ git remote add origin https://github.com/<username>/repo-name.git
$ git add --all
$ git commit -m 'initial commit'
$ git push -u origin master

How to add a git repository to Ubuntu server

I have a node.js project local in my computer, right now, I want to push this project to remote Ubuntu server. I have create a project.git on Ubuntu server, and pushed to it. Right now, I want to run this project on the server, but how do I access this folder, it's just a git directory. The process I am following is like below:
Ubuntu server:
mkdir /home/git/project
cd /home/git/project
git init
Local computer:
git remote add origin root#someserver.com:/home/git/project
git add .
git commit -am "Initial Commit"
git push origin master
It push succeed. Right now, I want to execute this node.js project and run it on the server, but how to turn this git repository to a folder, so I can cd into it and then node app.js after?
If you want to see the code on the server side, you should init the repository without --bare option or clone it somewhere else on the server.
Bare repositories store only git specific files.
UPDATE:
If you create a repository without --bare option, you can't push anything to that branch where your server is staying. Better solution is if you create a bare repository and clone it somewhere else on the server. Notice that, you should use there git pull command if you want to see your fresh code.

Added BitBucket repo as remote on GitHub

I've just installed git on Ubuntu, now I want to work on my repo in BitBucket. I'm a little confused on how to do so. I can't do the following:
git remote add BitBucketRepo git#bitbucket.org:dir/file.git
As it returns the following error:
fatal: Not a git repository (or any of the parent directories): .git
It clearly is pointing to a git repo, so why is it lying to me?
Also, it is worth noting I am using SSH and I have successfully paired my GitHub account to my computer.
You need to run this command from a local git repository (a directory in which you have run git init or git clone) - otherwise git remote doesn't know which local repo you want to add the remote for.
It should be as simple as cd my-local-dir, where my-local-dir is the directory containing your local (cloned) git repository.
If you don't yet have the repo available locally:
git clone git#github.com:...etc... my-local-dir
cd my-local-dir
git remote add ButbucketRepo git#bitbucket.org...
git push -u ButbucketRepo master
This will clone your code from Github into the my-local-dir directory, add your BitBucket repo as a remote repository, push your code up to Bitbucket and set the local master branch to track the BitBucket remote's master branch.
Tracking means that commands that involve a remote like git push will automatically use the BitBucket remote's master branch. If you don't want that behaviour, skip the -u option.

view the git repository on remote linux server -> in Windows?

Problem: Need to view Git history visually in windows, repository is on remote Linux server (Ubuntu).
Question: What are two easy ways to view the git repository on remote linux server -> in Windows?
I have initially tried mirroring the remote mirror, then viewing it locally - updating when needed, but I get an error when connecting,
git clone --mirror username#serveraddress.com:/home/username/projectfolder
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
Again I'm on Windows using Git Bash, trying to clone a remote repo that's on Linux.
Thanks in advance.
There is no importance where the repo resides.
As the error said,
1- make sure you have the address right
2- make sure you have access to the address

Resources