Тёмный

What is a bare Git repo and why you need them 

Engineer Man
Подписаться 537 тыс.
Просмотров 65 тыс.
50% 1

Bare repositories are similar to normal repositories except they are better suited to be used by multiple people as the authoritative repository.
Hope you enjoyed the video!
Join my Discord server to chat with me:
/ discord
Check out some code on my GitHub:
github.com/realtux
github.com/engineer-man/youtube
Come visit us on Reddit:
/ engineerman
Other Social:
/ _engineerman
/ engineermanyt

Наука

Опубликовано:

 

15 июн 2019

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 129   
@lukasberk9303
@lukasberk9303 4 года назад
You are so good at teaching. You ask the same questions I have during the video at the same time. This makes you more a teacher and a student who is sitting beside you wondering the same thing. Really nice.
@YisraelDovL
@YisraelDovL 5 лет назад
Yep this is how we did things before github was a thing, and even after if you wanted private repos. People thing github is synonymous with git, important to know that they are not.
@xenialxerous2441
@xenialxerous2441 5 лет назад
Hey there! I'm genuinely glad that I came across your channel & got to be a part of an amazing wealth/treasure of knowledge that is enlightening and informative. Thank you so much, & I'll join you over your discord server.. thanks again!
@michaelm3404
@michaelm3404 4 года назад
Wow. Best explanation, rich content. So many other channels spend so much time on fluff and groundwork, you just go straight to the point not worrying if you talk to fast (we are on RU-vid after all, people can rewind!) - great work.
@emjizone
@emjizone 8 месяцев назад
Finally I don't need to factor the tempo of the video by 1.5 or 2 to follow it without falling asleep or getting distracted. 😄
@bigmandan
@bigmandan 4 года назад
You can also use a bare repo and the hook scripts ( post-receive for example ) as a deployment mechanism too.
@EngineerMan
@EngineerMan 4 года назад
Huh, I never actually thought to use them for that purpose. Nice one.
@ItzeMiiSimi
@ItzeMiiSimi 5 лет назад
Clear, concise and helpful, thanks :)
@GabrielIchiro
@GabrielIchiro 5 лет назад
well that was intersting hopefully someday I'll need it, thanks Engineer Man!
@stefanciltea3186
@stefanciltea3186 4 года назад
Very on point and well made video, congrats!
@kkyes
@kkyes 3 года назад
I scratched my head for few hours and thank god I found you...so clear and precise explanation..
@gregorywpower
@gregorywpower 9 месяцев назад
Years later and this is one of the best videos on this topic.
@yeetyeet7070
@yeetyeet7070 Год назад
didn't even know I needed this, but I needed this so urgently
@user-yb1cm4fd6h
@user-yb1cm4fd6h 5 лет назад
Thanks a bunch. I didn't know about this feature and have started using it right after watching your video. I'm the sole developer on all my personal projects (as an humble hobbyist) and I actually have no need for remote services.
@harleyspeedthrust4013
@harleyspeedthrust4013 3 года назад
Be careful, if you host all your repos on a local disk you risk losing them if something happens. A huge benefit of remote hosting (like that provided by github) is that you don't have to worry about losing your work for good. In fact, github recently backed up a ton of repositories to a secure arctic facility (arctic code vault) that stores several copies of data in different formats
@user-yb1cm4fd6h
@user-yb1cm4fd6h 3 года назад
@@harleyspeedthrust4013 You're absolutely right but I have that covered with daily backups on my NAS, an external HDD and a USB thumbdrive, plus weekly backups on a remote backup service. I have never considered github as a backup solution, just a necessity to host my workflow until I discovered I could just have it locally with this video. You're right though, DO BACKUP FOLKS ;-)
@paulm3702
@paulm3702 5 лет назад
These videos git better every time!
@FirstLast-hm8oz
@FirstLast-hm8oz 3 года назад
Before I said "Igitigit", but now I say "Super".
@karolgutkowski4678
@karolgutkowski4678 7 месяцев назад
Great explanation, i stumbled upon bare repo when working with git worktrees and didn't understand what that bare repo i was having to pull was. Great and quick explanation, i even gasped when you cloned from a repo that was just on your local machine. All the abstraction that modern platforms provide kind of obstruct that this is "just" a fancy folder structure :)
@emjizone
@emjizone 8 месяцев назад
Clear, informative, straight to the point, no drama, and useful. Perfect for me. Best communication mode ever. Thanks !
@theRealtensigh
@theRealtensigh 5 лет назад
Very cool. It seems I have more to learn about Git every day.
@reza.kargar
@reza.kargar 3 месяца назад
Wonderful explanation 👌🏻, thank you 🙏🏻
@GuilhermeTeixeira
@GuilhermeTeixeira Год назад
Amazing explanation. Thank you!
@Zhouri
@Zhouri 2 месяца назад
Sometimes I really don't know whether im gonna use this knowledge or not, I just enjoy knowing it.
@shashankshekhar624
@shashankshekhar624 5 лет назад
Man, you are amazing
@MobiusCoin
@MobiusCoin 5 лет назад
2:24 Wrong! THis is sooooo useful! I absolutely need this! Thank you so much!
@heinzerbrew
@heinzerbrew 5 лет назад
Ummm.... Are you short on storage space or something? The bare repo doesn't do anything that the full one doesn't.
@EngineerMan
@EngineerMan 5 лет назад
For one, other people can't push to a branch in another repo that has the same name and is currently checked out.
@heinzerbrew
@heinzerbrew 5 лет назад
@@EngineerMan I see. I must have missed that in the video.
@moazelsawaf2000
@moazelsawaf2000 Год назад
Great video and very interesting concept ❤
@terry-
@terry- Год назад
Great! Would be very interesting to see this in convination with git worktree
@jpgarcia90
@jpgarcia90 Год назад
cool video, straight to the point, thanks! How would you go about hosting a bare repo on a cloud service like AWS?
@MarsGamer7
@MarsGamer7 5 лет назад
Great video!
@Omar.Alamoudi
@Omar.Alamoudi 3 года назад
This is a great and concise video. If you are looking into converting a regular repot to a bare repo see 4:20
@NicholasMaietta
@NicholasMaietta 5 лет назад
Okay, this is pretty awesome.
@m4rt_
@m4rt_ 11 месяцев назад
and if you put that bare repo on a server that you have ssh access on, you now host your own git repos (also you can actually work on code in a bare repo by doing: git worktree add and cd )
@alirezaparsay8518
@alirezaparsay8518 Год назад
Great, exactly what I needed to know.
@4mb127
@4mb127 Год назад
Great stuff
@cindrmon
@cindrmon Год назад
i discovered doing this by accident! now i'm able to have a private bare repository with all my important files that i wanna keep track on
@tobeypeters
@tobeypeters 4 года назад
I use one to make it simple to push my, mostly, dot files to GitHub. I can add a file from anywhere, commit it, and push it up to GitHub. So, if you look for tobeypeters on there, you'll see a dotfiles repo with my .bashrc and such.
@DigitalGrowthTree
@DigitalGrowthTree 3 года назад
Good video E-Man :)
@albertoazinar1209
@albertoazinar1209 3 года назад
one more time u saved my a**, thanks alot Engineer Man!
@ELIKOOKOO
@ELIKOOKOO 5 лет назад
Thanks for the video!, may i ask what OS r u using in that video? its not Ubuntu right?
@zinsy23
@zinsy23 4 года назад
I think it's Xubuntu if I'm not mistaken. He mentioned this in a few videos, including "10 things you can do with Linux that you can't do with Windows ".
@Matt23488
@Matt23488 5 лет назад
Wow, that's pretty nifty.
@bulletinmybeard
@bulletinmybeard 5 лет назад
Thank you, that was quite interesting and something I didn’t know about. I often clone gut repos to checkout the source code and will next time clone it as bare repos as I don’t have any interest to push anything I update. Thanks 🙏
@heinzerbrew
@heinzerbrew 5 лет назад
You missed the point of the video. You won't get any source code with a bare repository that is the whole point of it.
@bulletinmybeard
@bulletinmybeard 5 лет назад
heinzerbrew wrong
@heinzerbrew
@heinzerbrew 5 лет назад
@@bulletinmybeard How so?
@Speak4Yourself2
@Speak4Yourself2 Месяц назад
Thanks a lot!
@jaopredoramires
@jaopredoramires 2 года назад
hey man, what distro do you use? i really wanna know what terminal & what colorscheme you're using
@rbid
@rbid 5 лет назад
Many thanks
@deekshantmalvi4612
@deekshantmalvi4612 4 года назад
thanks man
@dexterman6361
@dexterman6361 5 лет назад
Who dem downvotes?! This is GOLD! Man an amazing channel!
@n3r0z3r0
@n3r0z3r0 5 лет назад
Thanks!
@tjoh4605
@tjoh4605 4 года назад
this is gold
@6s6
@6s6 5 лет назад
At 4:49, the files in felix_bare/ are listed with ls, and it shows all of the files within .git Shouldn't it just be listing .git, not the files actually in .git? At 4:35 you only moved .git into felix_bare/, right?
@wakaitsuwamono
@wakaitsuwamono 5 лет назад
Cool! I did not know that. Might not be a good question, since it's not for Git. Does the terminology and mechanics also apply to Mercurial. Cause it also has something like a .hg directory?
@bdafeesh
@bdafeesh 5 лет назад
Mercurial/svn share /some/ of these concepts, but will be completely different commands (at the very least). But if you can help it, don't ever use mercurial/svn. The technology is so outdated and strictly worse than git in almost every way. The only benefit something like svn has is that it comes pre-packaged with a GUI and a little easier to get started with. Any serious engineer uses git and is the industry standard.
@wakaitsuwamono
@wakaitsuwamono 5 лет назад
@@bdafeesh Thanks! Good advice.
@abhishektyagi4428
@abhishektyagi4428 5 лет назад
Sir Could you please make a video explaining the resources you use to learn or enhance your programming skills
@DavidWoodMusic
@DavidWoodMusic 2 года назад
Keep in mind he's been programming for 20 years. The best answer to this is to actually build things.
@mayur9876
@mayur9876 5 лет назад
That's so cool
@internetperson2
@internetperson2 5 лет назад
Dark souls players don’t want you to know this is where you can actually git gud
@williaamlarsson
@williaamlarsson 4 года назад
\o/
@90hijacked
@90hijacked 3 года назад
praise the sun ( son ) of nils torvalds
@paulmorrey733
@paulmorrey733 5 лет назад
Thanks
@danielmwale9959
@danielmwale9959 5 лет назад
If I pull in a bare repo and that becomes the core from which I get my workspaces, can I then later push to original repo?
@TerrisLeonis
@TerrisLeonis 5 лет назад
Yes, if you have the original repo as the bare repo's upstream remote (e.g. if you cloned the bare repo from GitHub), then you can just "git push" from the bare repo. Any commits you've pushed to the bare repo will then get pushed to the upstream.
@jada90
@jada90 5 лет назад
This is so obvious I feel silly for not thinking about this earlier. Is this how people used git before github and gitlab?
@EngineerMan
@EngineerMan 5 лет назад
Yes, particularly useful for internal networks and ones with shared drives.
@m4l490n
@m4l490n 5 лет назад
Cool! Now please make video about how to host our own git repos in our own linux server so we can access them across the internet.
@sabrinnnaaaaaaa
@sabrinnnaaaaaaa 5 лет назад
I think an ftp server would work, you could put it's ip in when you're cloning
@thanatos454
@thanatos454 5 лет назад
Have you looked into using GitLab? www.techrepublic.com/article/how-to-set-up-a-gitlab-server-and-host-your-own-git-repositories/
@unabonger777
@unabonger777 4 года назад
@@sabrinnnaaaaaaa You can use ssh and set up a shared directory on the server for the repos to live in.
@blank001
@blank001 3 года назад
Bare repo for dotfiles This is such a easy way to manage dotfiles across multiple systems and track them easier
@akaziehl
@akaziehl 5 лет назад
Question. If you commit something to the repository, does the bare repo update too? Since I've understood when you commit you do the commit to the actual repository, not the bare one.
@sabrinnnaaaaaaa
@sabrinnnaaaaaaa 5 лет назад
If I understand correctly, the bare repo acts like a fork, so it wouldn't update with the original repo
@user-yb1cm4fd6h
@user-yb1cm4fd6h 5 лет назад
You have to push to the bare repo, as you would with a remote repo (github, etc).
@aydencook03
@aydencook03 5 лет назад
I don't know what most of this means, but I really want to learn... Where do I start? Where did you start? And what resources have you used?
@esbenboye
@esbenboye 5 лет назад
There's lots and lots of online resources and thus, lots of places to start. It's hard to point to one specific resource, but searching for "getting started with git", "git for beginners" or "git tutorial" will ger you something to work with :)
@JethroYSCao
@JethroYSCao 3 года назад
Does git fetch work in a bare git repo?
@tylersmith8245
@tylersmith8245 2 месяца назад
Wild
@faizanvanekar7882
@faizanvanekar7882 6 месяцев назад
How can we add this GIT repo to our Jenkins job to build ? Is that even possible? Kindly let me know. Thank you in advance !
@pixelPlex
@pixelPlex 5 лет назад
Would a bare Git repo be the way to go when making a backup of a existing Git repo?
@heinzerbrew
@heinzerbrew 5 лет назад
It depends on what you want. He explains the difference in the video. A bare git repo won't have your workspace. So if you want your complete repo backed up then you need to back up the whole thing. If you just want to be able to restore your project then the bare git will be the bare minimum to backup. Git it?
@aravindreddy6802
@aravindreddy6802 5 лет назад
Git rebase vs cherry pick plzz
@StphRolland
@StphRolland 3 года назад
It seems clear how to clone the repo from a shared drive where would be the bare repo. But I have not grasped how to push, and pull. How do you define the remote, if this remote is not using neither ssh nor http ? Maybe your video goes a bit too fast on this.
@StphRolland
@StphRolland 3 года назад
Self answering: no explanation is needed, it is super extra simple => the fact of cloning the repo from the file system creates a git repo that does not need either ssh or https. When doing git push origin master, it will simpy copy to the filesystem address. Simple and direct like that. I could not believe it.
@usingvancedplzdontban1128
@usingvancedplzdontban1128 4 года назад
Which linux distro is he using?
@eslamalshiki2650
@eslamalshiki2650 4 года назад
Alsalam Alikom, I want to devolop a system that is like a githup, so, what shuld i do, bare repostry or non-bare, becouse the non-bare makes clients cannot push to origin if the origin is checkedout to master and the client too.
@EngineerMan
@EngineerMan 4 года назад
I think you answered your own question. GitHub likely uses bare repos as the base.
@richrollin4867
@richrollin4867 2 года назад
The last bit really confused me, you created a bare repo from the other repo, but then cloned it and it contained all the workspace files - but you said that bare repos don't contain workspace files.
@terry-
@terry- Год назад
Its becose the command git clone, without --bare creates the workspace.
@fadop3156
@fadop3156 5 лет назад
What distro is he using?
@diegoallozagonzalez4470
@diegoallozagonzalez4470 5 лет назад
xubuntu
@shirounurimba6898
@shirounurimba6898 5 лет назад
Could anyone tell me what's a workstation?
@benjamincvcvcv7
@benjamincvcvcv7 5 лет назад
A computer you do work on. Eg a desktop or laptop
@shirounurimba6898
@shirounurimba6898 5 лет назад
@@benjamincvcvcv7 Ah, gotcha. Thanks for the info!
@rizwanfirdous
@rizwanfirdous 4 года назад
How to push a bare repo to GitHub and make as a GitHub project??
@YisraelDovL
@YisraelDovL 5 лет назад
To convert to a bare repo, you could have just cloned the non-bare repo with the --bare flag. Also worth pointing out that you can do all of this with non-bare repos as well.
@heinzerbrew
@heinzerbrew 5 лет назад
Mmm... Yes I was wondering why the big fuss? I see so many positive comments here, but from what I can tell the only advantage with the bare git is that it doesn't take up as much space since it is only the git folder. There are people gushing with praise for this video and how useful this tip is, but I don't see what is so great about it. What am I missing?
@unabonger777
@unabonger777 4 года назад
@@heinzerbrew You use ssh and set up a shared folder on a server for your remotes. So you don't need github, etc.
@heinzerbrew
@heinzerbrew 4 года назад
@@unabonger777 Correct you don't need git hub, you never did before this video. So why are people losing their minds about how awesome this video is? I am not trashing the video. I just don't get some people's reactions.
@nodidog
@nodidog 2 года назад
🐻
@AnCacaMilis
@AnCacaMilis 5 лет назад
I've watched this video 3 times through now and as a regular (newbie) user of git, I can't grasp why this is useful. 😔 Went right over my head
@user-yb1cm4fd6h
@user-yb1cm4fd6h 5 лет назад
So you can use a local folder instead of a remote service like github to pull/push from.
@AnCacaMilis
@AnCacaMilis 5 лет назад
@@user-yb1cm4fd6h thanks for response. Think I need to research a bit more 👍
@heinzerbrew
@heinzerbrew 5 лет назад
@@user-yb1cm4fd6h ummm you can do that with a regular repository.
@kamesenLBC
@kamesenLBC 5 лет назад
BEAR REPO
@EngineerMan
@EngineerMan 5 лет назад
Did it all with my bear hands.
@matthewb3853
@matthewb3853 2 года назад
I wish this video ended at 2:28
@Tux.Penguin
@Tux.Penguin 5 лет назад
Using a local offline repo like you outline in this video might have some advantages, but doesn’t it leave you more vulnerable to losing your project? If you’re going to protect your work by backing up regularly (which we all should) wouldn’t it just be simpler to skip this whole bare repo thing and use an online service like GitHub?
@bhc1892
@bhc1892 5 лет назад
There are situations where github isn't the right option. For me they happen a lot. The fact that git can be used in this way is why I fell in love with it to start with. I can start a small project, run "git init" in the folder, and suddenly I've got version control, branches, and the ability to let coworkers collaborate with me by doing "git clone ssh://user@myip:/path/to/the/repo". And if you spread the work across multiple computers, git is giving you a ghetto backup solution anyway, since both machines have the full repo.
@Little-bird-told-me
@Little-bird-told-me Год назад
what i learned use git add -A instead of git add .
@bhc1892
@bhc1892 5 лет назад
Just to share a cool way bare repos have helped me in the past - I had two non-networked computers that were being used to dev on a codebase. To keep things in sync, I created a bare repo on a removable hard drive, and cloned to both computers from the removable drive. Then once a day we'd plug the drive into each computer and do git pull..., git push.
@subkhanave
@subkhanave 5 лет назад
i know git bare repo is from oxidized (rancid alternative)
@antonsurviyanto5896
@antonsurviyanto5896 5 лет назад
how to update installer packages from git clone?
@tolulopemakinde4538
@tolulopemakinde4538 9 месяцев назад
Very very very explanatory video... It needs that exaggeration.
@ClauSalvio
@ClauSalvio Год назад
Converting Non-bare repo to Bare repo: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-8aZW9mYOxhc.html @engineerman Thanks for this good explanation!
@diegonovas4974
@diegonovas4974 5 лет назад
Your subtitles are only in Russian. Can you put them in English?
@EngineerMan
@EngineerMan 5 лет назад
I have Russian subtitles?
@diegonovas4974
@diegonovas4974 5 лет назад
@@EngineerMan It is the option that appears.
@love.society
@love.society 5 лет назад
@@EngineerMan haha It generated automatically) RU-vid is kidding
@love.society
@love.society 5 лет назад
@@EngineerMan but I can help you with Russian subtitles
@robertbrooks3849
@robertbrooks3849 5 лет назад
4th :-)
@kyleztoohype2056
@kyleztoohype2056 5 лет назад
First
Далее
Git Bare Repository - A Better Way To Manage Dotfiles
16:56
Git Good: Common Commands
13:52
Просмотров 20 тыс.
Кошка-ГОНЧАР #шортс #shorts
00:28
Просмотров 671 тыс.
Engineer Breaks Down Hollywood Programming Scenes
11:02
Git Better Than 95% of People
9:33
Просмотров 17 тыс.
Understanding Fork Bombs in 5 Minutes or Less
5:55
Просмотров 166 тыс.
What is a Bare Git Repository
4:35
Просмотров 15 тыс.
13 Advanced (but useful) Git Techniques and Shortcuts
8:07
Git Source Control For The Impatient
16:36
Просмотров 43 тыс.
Dotfiles! Here's how I organize them.
9:37
Просмотров 39 тыс.
So You Think You Know Git - FOSDEM 2024
47:00
Просмотров 1 млн