I am trying to clone a repository into my current directory. However, when I clone it with this command:
git clone REPOURL .
it says:
fatal: destination path '.' already exists and is not an empty directory.
The folders that I am cloning into already exist and I just want to add files that I have in the git repo.
Is there any way I can do this?
Thanks
To clone git repository into a specific folder, you can use -C <path> parameter, e.g. Although it'll still create a whatever folder on top of it, so to clone the content of the repository into current directory, use the following syntax: cd /httpdocs git clone [email protected]:whatever .
Cloning a repository pulls down a full copy of all the repository data that GitHub.com has at that point in time, including all versions of every file and folder for the project. You can push your changes to the remote repository on GitHub.com, or pull other people's changes from GitHub.com.
Simply clone your project's repo twice (or even more often). When your work on a feature branch is done, simply push that branch and check it out on your 2nd copy to run tests there. You can pick up a new story and work on that on your "main" project directory.
You don't need to clone the repository, you need to add remote and then add the files to the repository.
git init
git remote add origin <remote_url>
git fetch --all --prune
git checkout master
git add -A .
git commit -m "Adding my files..."
You already have a remote repository and you want to add files to this repository.
First you have to "tell" git that the current directory is a git repositorygit init
Then you need to tell git what is the url of the remote repositorygit remote add origin <remote_url>
Now you will need to grab the content of the remote repository (all the content - branches, tags etc) git fetch --all --prune
Check out the desired branch (master in this example)git checkout <branch>
Add the new files to the current <branch>
git add -A .
Commit your changes git commit
Upload your changes back to the remote repository git push origin <branch>
You can use the git clone --bare origin_url
syntax to just clone files(not repo foder).
Try:
mkdir tmp
cd tmp
git clone --bare origin_url ./
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With