Try this:
git init
- To start the local repository;
git remote add nome-repositorio-remoto end-repositorio-remoto
- To indicate the address of the remote repository;
git push nome-repositorio nome-branch
- This will cause you to send a branch (branch-name) to your remote repository (origin).
Example:
$git init
$git remote add origin https://[email protected]/tonidev/bootstrap4.git
$git push origin master
EDIT 1: Local bare repositories
You may, for example, need authentication for read access or may require more server speed. For each of these choices, there is a recommended protocol. Github, for example, provides read access to public repositories via git protocol (lighter and faster). But for write access of project commiters, it uses SSH (a bit heavier, but provides authentication). Another option is HTTP for reading, which makes it easy to traverse corporate firewalls.
Finally, there are basically four options:
- Local mapping
- SSH
- git's own protocol
- HTTP
What you will choose (or whether you will opt for a hybrid solution such as Github) depends on your needs.
With the command git init --bare
you are creating a repository that is pushable . Generally bare repositories are created on the server and are considered repositories for storage, in contrast to the repositories that go on the developers' machines that would be the development repositories created with the command git init
(without --bare
). >
Although the GIT is a distributed versioning control system, it is very common that there is a central repository that facilitates the exchange of information between the developers, avoiding the need for the developers' computers to communicate directly with each other. >
In addition, bare repositories do not have working directory , making it impossible to edit and commit files in this repository.
But for you:
Creating Repository Structure on External HD
mkdir repositorios
cd repositorios
mkdir nome_projeto
cd nome_projeto
The command below creates a remote repository, must be rotated inside the External HD
git init --bare
Creating local repository and sending to remote
git init
Initial commit "-a" will add all the files in the commit and "-m" will allow you to add a commit comment.
git add .
git commit -a -m 'comentário'
Recording the External HD address so you do not have to always type
git remote add hdexterno /caminho-do-hdexterno/caminho-repositorio/caminho-projeto
#se precisar remover
git remote rm hdexterno
updating hdexterno
git push hdexterno
to clone an external hd project on your machine
git clone /caminho-do-hdexterno/caminho-repositorio/caminho-projeto
getting news from external hd and updating on the machine
git pull hdexterno