Home git how to configure the connection to the remote git repository

how to configure the connection to the remote git repository

Author

Date

Category

How to configure connection to a remote git repository, via SSH, on a computer with Windows 7. And accordingly, pump out the contents to your local server.

Remote repository is on the server with Git. I just need to block the contents. No way back. There is an identification. General Public Kay and sent specials on that side. How can I add a previously generated key through the console and connect to the server? What are the teams ..? Windows 7 on my car.


Answer 1, Authority 100%

Installation

If not yet installed, then Git can be taken here. Together with him there will be a UNIX-LIKE Console Git Bash.

https://github.com/git-for-windows/git/releases /

Cloning via SSH

Example of a team for cloning through SSH.

git clone [email protected]: broccgr / csshx.git

In general, the SSH cloning command looks like this:

git clone [email protected]: user / reponame.git

Do not confuse with HTTPS, which will require authorization via login password:

git clone https://github.com/brockgrr/csshx.git

Creating an SSH key.

On Windows, you can both through CMD and & nbsp; Git Bash, on * NIX – & nbsp; just in the console. But in CMD, I do not understand, so I bring instructions only for Git Bash & Amp; * NIX:

ssh-keygen -t rsa -c "[email protected]"

You can choose Passphrase, which increases reliability, but it will need to be entered each time using. If forget – the key is useless for further use.

After executing the command, the public key appears accordingly in

C: \ users \% UserName% \. SSH \ ID_RSA.PUB
~ / .ssh / id_rsa.pub

It is a public key that needs to be transmitted by a specialist on that side. (Surely you did, but still it is worth saying this)

If everything is done correctly, then when you try to connect the SSH key, the key will be used automatically.

if the key already has

It must be put in C: \ Users \% Username% \. SSH . If the key name is different from ID_RSA , you need to create a c: \ users \% username% \. SSH \ Config with the following contents:

host: server.domain
 IDENTITYFILE PATH_YE_IMIA_WERS

Answer 2, Authority 65% ​​

In practice, this article once helped me – the best example of everything I saw:
http://habrahabr.ru/sandbox/37865/

It completely shows client programs for working with Push-Ohm and Pull. I personally have a Windows who disliked the native Git client, but it always works great with Tortoise (in the article).

It has a complete connection guide. Not sure whether it is correct, but you can put yourself a Composer program and her like, after which it is possible through the Windows console to completely clon yourself to the repository with git-a.

If it concerns a more specific connection to Git, this page will be useful: http://webhamster.ru/site/page/index/articles/comp/171


Added, as they asked, briefly the contents of the article:

We go to the official page of Git http://git-scm.com , click on download for windows. In the window that opens, click on Full Installer for Official Git. Run the exe-shnik received.

I recommend choosing “Run Git From the Windows Command Prompt”. All other options can be left by default. After installing the Git, you need to reboot or complete the user session and log in to apply the changes in the PATH system variable.

Next you need to check if Git is available to work. In any catalog we give the team:

Git --version

If we get information about the version, then Git is installed and running. If we get the information that the GIT program is not found, we understand what they did wrong.

Setting up SSH keys in Windows

In the Windows operating system, the SSH key generator is included in the GIT package. To generate keys, it is necessary to run the file C: \ Program Files \ Git \ Git Bash.vbs. It can be launched as a regular EXE-Schnick. The Git Console program opens. It must be given a command:

ssh-keygen -t rsa -c "[email protected]"

Be careful, in this console, the copy-paste does not appear, it is easier to enter the command manually. As an email, specify your mailbox. On request “ENTER FILE IN WHICH TO SAVE THE KEY” simply press ENTER. When requesting the password “ENTER PASSPHRASE” and “ENTER SAME PASSPHRASE AGAIN” simply press ENTER. In the process of generating keys in the console, approximately the following information will be issued:

Generating Public / Private RSA KEY PAIR.
ENTER FILE IN WHICH TO SAVE THE KEY (/ C / Documents and Settings / username / .ssh / id_rsa)
ENTER PASSPHRASE (EMPTY FOR NO PASSPHRASE):
ENTER SAME PASSPHRASE AGAIN:
Your Identification Has Been Saved In / C / Documents and Settings / username / .ssh / id_rsa.
Your Public Key Has Been Saved In / C / Documents and Settings / username / .ssh / id_rsa.pub.
The Key Fingerprint IS:
51: DB: 73: E9: 31: 9F: 51: A6: 7A: C5: 3D: DA: 9C: 35: 8F: 95 [email protected]

After executing this program, in the C: \ Documents and Settings \ username.ssh directory, the ID_RSA and ID_RSA.Pub files will be lying, they will be useful for us later.

Installing an SSH key in github

We can remember as much, this part of the answer has changed somewhat in modern design GitHub-A, but intuitively can be found.

Immediately after registration, you must register your public key encryption key in the Guthub system (open SSH key). To add a key, you need to press “Account Settings” in the upper right corner.

In the window that opens, click on the “SSH Public Keys” menu, and click “Add Another Public Key”. Two fields will appear – the key name (title) and key contents (Key).

In the Title field, you can write the name of the computer on which the public key is generated. You can write in Russian.

In the Key field, you need to insert the contents of the id_rsa.pub file. Remember, in which catalog are they? Go to this directory, open by any text editor id_rsa.pub (it is with the extension .pub do not confuse). We highlight all the text, copy, and insert on the GitHub page in the Key field.

After adding a key, the computer can connect to the GitHub through the GIT program, and no errors should occur.

work with a repository on GitHub through the Git program

Starting from this point, the dances around the GitHub web-interface can be considered finished. Next, you can only work using the Git program.

First you need to make a small setup of the Git program: Specify the Local GIT system of the user and email. This is done by the following commands that can be performed while in any directory:

git config --global user.name "youurfullname"
Git Config --Global User.Email [email protected]

Where, instead of yourfullname you need to write your name, and instead of [email protected] – your email. These values ​​are used for login on GitHub. Therefore, you need to specify your login on the GitHub-E in place, and you need to specify email on the site [email protected] when generating encryption keys.

After these settings, you can pour your files to the repository. Go to the catalog with your project, and give commands:

git init
Git Add.
Git Commit -a -m 'First Commit'
Git Remote Add Origin [email protected]: username / reponame.git
Git Push -u Origin Master

After these commands, a copy of the files of the directory is formed on the GitHub server, in which these commands were performed. Next, you can already make commits, fill to the Github server changes, read changes from the server. But this is a completely different story.


Answer 3, Authority 6%

You have already provided links to download. I will not repeat.

After installation, you will need to select a directory in the system (or create where you want), where the local copy will lie in what is in the remote repository. After that, in this directory:

git init

Do not forget to configure your git via:

git config --global user.name
Git Config --Global User.Email

This is especially true for Crucible atlasina (for the Code of Review).

Note: The –Global option to use if you are the only user of the gita on this computer. If not, adjust the GIT under a specific user in the

system

Note about user configuration is rather optional.

Explore the official user documentation on the site or, after installing the client under Windows, run Git –help to get help.

To clone the repository to your local folder, use:

git clone ssh: //[email protected]/git/folder/here

You can also use the Gita Graphic version, although I personally prefer to use the console everywhere, it seems to me more informative.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions