Given an existing private remote repository, to which I have access to, which contains only a README.md and a .gitingore file. Lets call this repo "myRepo".
Locally on my machine, I created a folder "myRepo", added some files to it and want to push everything to the remote "myRepo".
I am aware of the git init command. I would probably have to do git remote add "url_to_myRepo" then. Is this the right way to go?
And, my local folder contains a whole bunch of files which I do not want to be tracked by git. Do I have to create a .gitignore file before I do git init, or can I do it also afterwards?
>Solution :
Running git init just creates a local repository directory. You then need to git add files. You can add individual files explicitly with that command, but if you are going to add directories, you should probably have the .gitignore file created first. Then of course you need to git commit to actually have the files actually saved into the repository. Finally as mentioned by @bronislav, you need to run the git remote add origin <url> command to allow you to git push the repository to the remote.