How do I remotely connect to Git

Asked

Viewed 10,525 times

3

I already know what we use versioning for, how to do commits, add new files, logs, etc. but I would like to upload my files to the Github online repository, as I do to connect and upload my files?

2 answers

3

Configure the GIT client to link commits to the correct name ( Author of commits)

git config --global user.name "SEU NOME AQUI"
git config --global user.email [email protected]

To initialize the empty GIT repository there are two ways.

[1] Running the command below, git will create the folder if it does not exist and initialize as a GIT repository. Ex:

~$ git init name_project

[2] Create the folder and then enter the folder and then initialize the repository, it would look like this:

~$ mkdir name_project
~$ cd name_project
~$ git init

Log into your repository and create the README file

~$ cd name_project/
~$ vim README

Write an initial text such as "First commit" and save the file (:wq)

~$ git status

It will appear to the data as image below, but what does that mean? Well, the important part of this screen is Untracked files that shows the files that GIT is not yet managing, that is, GIT doesn’t know what to do with it and doesn’t record any changes to the file.

then just add and commit the file:

~$ git add README
~$ git commit -m "Adicionando arquivo README"

Next step is to go up to the repository with:

~$ git push

If you want to download on a server or another computer use the command:

~$ git clone [url]

(this url is given in the directory that was created)

After cloning to download updates use:

~$ git pull

2


Alexander, I assume you already have a Github account...

So here’s the thing:

  • First manage ssh key pair: ssh-keygen -t rsa

PS: If you don’t have the ssh, must install

  • You create a repository on Github for your project
  • Copies the url it generates. Something like: https://github.com/usuario/nome_do_projeto.git

  • So in your local git, give the command: git remote add origin https://github.com/usuario/nome_do_projeto.git

PS: origin is just a default name you can put any name. It will be the name of your remote repository

  • Then you give the command: git push origin master
  • Enter the password and ready.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.