Reputation: 3930
I got a .git directory for me to work on, supposedly containing files and data to run.
I only a see a bunch of directories (branches, hooks, info, objects, refs) and some files (config, description, HEAD), but can't figure out what to do with them.
I'm assuming I should somehow link it with GitHub, except I have no idea how.
Upvotes: 5
Views: 8220
Reputation: 72226
The .git
directory should stay inside your project directory. If all you have is the .git
directory then create a new directory to store the project and move the .git
directory into it.
Then open a console, cd
to the project directory and run:
git checkout master
master
is the usual name of the main branch in a Git repository, but this is just a convention, Git doesn't enforce the name in any way.
If if doesn't work you can try:
git branch -a
to list all the branches of the repo. Then pick a branch and run git checkout
using its name as argument.
If you never worked with Git, reading the Git book is a good starting point. After you understand the concepts, use git help <command>
to learn the exact parameters and switches to run git <command>
. Or read them on the online documentation.
Update:
You say in a comment: "co-worker just gave me the location of the directory on the server". The co-worker probably gave you the URL of the central repository. If this is the case then create an empty directory for the project, cd
into it and run:
git clone <url-of-the-repository> .
Replace with the actual URL provided by your co-worker.
When the cloning completes, use git branch
to see the branches, git checkout
to check a branch out in order to work on the code, git add
git rm
to prepare a commit, git commit
to do the commit, git fetch
/git pull
to get the most recent changes from the upstream repository into your local repository, git push
to send your changes to the upstream repository, git log
to inspect the repository history and so on.
Upvotes: 1
Reputation: 23189
I suppose what you got is a bare repository. In order get the files out of it, you must create a non-bare clone.
Assuming that the directory you have mentioned is located at /path/to/my/repository.git
, then by running the following command in a terminal:
git clone /path/to/my/repository.git /output/directory
you will find the contents of the repository in /output/directory/
.
(You have to replace the directory paths with actual paths on your computer.)
Upvotes: 16
Reputation: 474
You should install GIT to use the GIT repository. Get it here: https://git-scm.com/downloads
After you download and install it. you can open a CMD and type
git branch --list
to see what branches are in the repo. and run
git checkout [branchename]
to build the branch filesystem.
To push to a remote, type
git remote add origin <your repository address>
and to push to your git repo:
git push origin --all
Upvotes: 2
Reputation: 1
Don't touch yourself your .git directory if you dont know what you are doing !! use git commands instead.
http://rogerdudler.github.io/git-guide/
The command you are looking for is:
git remote add origin <repository_address>
Upvotes: -1