Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add my current project to an already existing GitHub repository

I'm very new to Git. I've been searching for an answer, but I couldn't find one.

In my computer I have a project folder like this:

project_a --some_folder --another_folder --.git 

And I have a repository on GitHub, let’s say https://github.com/company/our_repo.git. Under this repository I have some folders. So my goal is to put my project_a under trunk/bin. How do I achieve this? (Again, I'm very very very new.)

like image 248
Vor Avatar asked Jun 03 '13 13:06

Vor


People also ask

How do I add files to an existing GitHub repository?

On GitHub.com, navigate to the main page of the repository. Above the list of files, using the Add file drop-down, click Upload files. Drag and drop the file or folder you'd like to upload to your repository onto the file tree.


2 Answers

Open your Terminal, access to this folder and write:

git init git add . git commit -m "my commit" git remote set-url origin [email protected]:username/repo.git git push origin master 
like image 57
Ziyaddin Sadigov Avatar answered Oct 06 '22 08:10

Ziyaddin Sadigov


I had more luck with navigating in my terminal to the directory I wanted to add to the repository, then (assuming you're working on a branch called master):

    git init     git add .     git commit -m "my commit"     git remote add origin <remote repository URL>     git push origin master 

Here's a link to an article explaining how to do it in more detail: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/

Note that you won't be able to run the "git add ." line if the directory in question is open.

like image 32
Adam Avatar answered Oct 06 '22 08:10

Adam