Access source files from git BARE: wizard

I am sure that something fundamental is missing here, but I got a drop of the application stored in the git repository. It has folders, such as: branches, hooks, objects, etc., but there are no real source files.

When I open git bash and cd in this folder, the title says "(BARE: master)".

I assume that I just need to somehow clone the local repository from this folder. Ultimately, I just need access to the actual source files in the repository, but I certainly missed out on some concepts, as I'm somewhat new to git.

Any hints or help on how I can get this setting locally will be appreciated.

edit: when I try to clone from this directory, I get the following error

$ git clone c:/Users/Joel/Dropbox/TheProjectDirectory.git Cloning into LocalProjectFolder ... fatal: 'c:/Users/Joel/Dropbox/TheProjectDirectory.git' does not appear to be a git repository fatal: The remote end hung up unexpectedly 
+6
source share
2 answers

This is the bare repository you have.

The easiest way to get sources is to clone it through git clone /path/to/your/bare/rep

Naked repositories are a kind of shared repository where the work of several developers is collected. For the developer box, you most likely want not naked.

Here's a chapter on repository cloning.

EDIT: So, I have a git repository on my inbox. Therefore, I will try to imitate your situation. First I will clone my repository as one:

 idanilov@IDANILOV-PC /d/test $ git clone --bare /d/work/gittesting/ bare.git Cloning into bare repository bare.git... done. idanilov@IDANILOV-PC /d/test $ cd bare.git/ idanilov@IDANILOV-PC /d/test/bare.git (BARE:master) 

So, I have a bare.git repository, as you have a shared folder. Now I will clone it in order to have some kind of working directory with real sources:

 idanilov@IDANILOV-PC /d/test/bare.git (BARE:master) $ cd .. idanilov@IDANILOV-PC /d/test $ git clone bare.git/ my-non-bare-dev-rep Cloning into my-non-bare-dev-rep... done. idanilov@IDANILOV-PC /d/test $ cd my-non-bare-dev-rep/ idanilov@IDANILOV-PC /d/test/my-non-bare-dev-rep (master) 

Now I have my-non-bare-dev-rep folder, and all the files from the repository are there. This is a working copy. The line (master) is a hint for you that you are currently in the master branch.

Then I will imitate some work in my working copy.

 idanilov@IDANILOV-PC /d/test/my-non-bare-dev-rep (master) $ echo 'my new text' > text-file.txt 

I want to see the changes that I have in the working copy, compared to the version obtained from the share:

 idanilov@IDANILOV-PC /d/test/my-non-bare-dev-rep (master) $ git status # On branch master # Untracked files: # (use "git add <file>..." to include in what will be committed) # # text-file.txt nothing added to commit but untracked files present (use "git add" to track) 

Now I will add this text file to the so-called scene area (or sometimes it is called an index). This is a term to describe the set of changes that will be performed when the git commit command is executed.

 idanilov@IDANILOV-PC /d/test/my-non-bare-dev-rep (master) $ git add text-file.txt 

Well, now text-file.txt is in the scene area. But it is not done yet. It's time to do this:

 idanilov@IDANILOV-PC /d/test/my-non-bare-dev-rep (master) $ git commit -m 'my commit from dev repo' [master c0b0bd8] my commit from dev repo 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 text-file.txt 

So. Now it is stored in my local repository. In the .git folder. But he still didn’t go for a joint repo so my colleagues saw it too. To do this, I need to push :

 idanilov@IDANILOV-PC /d/test/my-non-bare-dev-rep (master) $ git push origin Counting objects: 4, done. Delta compression using up to 4 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 290 bytes, done. Total 3 (delta 1), reused 0 (delta 0) Unpacking objects: 100% (3/3), done. To d:/test/bare.git/ d01886b..c0b0bd8 master -> master 

origin is the standard git name that gives parents when you made a clone. So, as I did cloning from bare.git - my changes just went there. And finally, to get updates from the shared folder to the local repository, you need to run the pull command:

 idanilov@IDANILOV-PC /d/test/my-non-bare-dev-rep (master) $ git pull Already up-to-date. 

I do not have any changes that were ported to bare.git from other places, so my local representative has been updated. And git told me about it.

+13
source

Use

 git clone /c/some/dir.git 

In git bash. C: type paths are not handled well.

+4
source

Source: https://habr.com/ru/post/890872/


All Articles