First, have Git installed and configured on your machine.
As you mentioned, your project has many packages. When using a package manager it is not necessary to send the packages to the repository because of the file containing the list of all packages and dependencies used. In most managers this file is package.json
.
To prevent packages from being sent, create a file called .gitignore
. The contents of this file will define which folders and files should not be uploaded to version control. This varies from environment to environment and from project to project.
On the Mac, for example, a .DS_Store
file is created in all folders, which has some file explorer parameters. This is an example of a file that should not be sent to Git.
Another situation is some text editors or IDEs, such as Visual Studio Code, which creates a .vscode
folder with the editor / IDE settings specific to your project. One more that should not be sent.
I'll leave an example of .gitignore
as I would in an environment like yours:
/vendor/
/node_modules/
/bower_components/
.DS_Store
With .gitignore
created and Git installed you are ready to send your code to GitHub. If you have not yet created a local Git repository, follow the steps below:
Navigate to your project. I do not know if you're using Mac or Windows, but it's simple in both cases. Open the terminal on the Mac or the command prompt in Windows and navigate to the root folder of your project. You can use the cd <caminho>
command in this case on both platforms.
Create a local repository. Still using the command line, run git init
to create the repository.
Commit what you have. Run git add .
to add all files in the folder to your pending commit changes. Finally, run git commit -m "<mensagem qualquer>"
to actually "commit" in the local repository.
Ok, local repository created, now for GitHub.
Create a GitHub repository. Click here and create a new repository. Since you already have a .gitignore
, create this repository without it.
Add your GitHub repository as a remote. Use the git remote add origin https://github.com/<seu_username>/<nome_repositorio>.git
command to set your remote repo .
Push the local changes to the remote. Rotate the command git push -u origin master
.
Now just go to https://github.com/<seu_username>/<nome_repositorio>
to see if everything is there as it should be.