How to push local folder to GitHub

2

I would like to push from a local repository to my GitHub. For this I did the standard procedure:

git clone <chave ssh>

So much so, he created a copy of the GiHub repository locally. Inside this repository there is a folder with files that I also want to send to the corresponding repository in GitHub. I made add and commit of the folder and then made a push to the repository in GitHub, but apparently it only adds the folder and not its files. I navigated to the folder and did the same previous procedure and got the following output:

$ git push origin master
ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Any suggestions on how to push of these files?

    
asked by anonymous 26.05.2014 / 16:02

3 answers

6

I had a very similar problem when I started versioning with Git + GitHub, and this problem occurred when the remote directory was not created for 'origin'.

To do this you need the following command:

git remote add origin [endereco-do-repositorio]

git clone guarantees only one copy of the repository. For more information you can access GitHub Help .

    
08.07.2014 / 18:49
1

Just complementing soaresfelipe's answer:

git remote add origin <URL> will add the address to your remote repositories (which should be enough in your case). But I advise you to use git add -A in the root folder of your repository later, yes git commit before pushing, because apparently you are not committing all the files.

If you are unsure, you can use git log to check which commits have already been made.

    
08.07.2014 / 21:41
0

Type to check if you have any repository:

 git remote -v

If so, something like this will appear:

origin  [email protected]:<seu_usuario>/sua_app.git (fetch)
origin  [email protected]:<seu_usuario>/sua_app.git (push)

If it does not appear and inform you that there is no repository you will have to add some. If for GitHub:

Click the + > New repository (this is located in the menu next to your user's photo).

Then just fill in the data as the name of the repository, if you choose the public or private type. Then GitHub will inform you what you need, just follow up.

    
02.12.2017 / 00:28