In Windows, TortoiseGit over Putty or Openssh submits the project to GitLab.

Source: Internet
Author: User
Tags windows 7 x64 ssh git client ssh port web ssh
Gitlab's default configuration is recommended to use shell command lines to interact with the server. As an SCM, it means no pressure. However, as a developer, it is more suitable for windows GUI graphics management, so that they can focus on code writing, so today we will introduce you to the remote server by using the git client tool in windows.
Solution:
Environment deployment
Windows 7 x64 Sp1
TortoiseGit TortoiseGit-1.8.11.0-64bit.msi
Git Git-1.9.4-preview20140815.exe
Putty PuTTY 0.63
OpenSSH owned by Git
Download Address: http://yunpan.cn/QaaLGsd23BsWL (access password 96d7)
Note: The installation packages at the Download address are 64-bit. For 32-bit versions, please download them separately.
I. Preparations before deployment
Install TortoiseGit, Git, and Putty. By default, you can install TortoiseGit. Git is the Git client environment installation package to ensure that windows contains the git environment.
2. Configure PuTTY authentication agent
After installing TortoiseGit, you can choose to use the OpenSSH client or Putty client. If the default Putty client is used, the TortoiseGit GUI connection does not support server-side custom port configuration, if the SSH port used by GitLab is a custom port, you need to use the authentication agent of PuTTY for local port forwarding.
1. Use Puttygen of TortoiseGit to create a local public/private key pair.
2. Click Generate. In the blank area of the window, shake the mouse as prompted, Generate a public/private key pair, and save it to the local device.
Testkey is the public key, and testkey. ppk is the private key.
3. Paste the Public key generated in the window to the SSh Keys of the account used by the GitLab site to upload the Public key.
 
4. Use PuTTY to connect to the gitlab server. Select the private key generated locally before opening.
Here, the server domain is git.example.com.
Git is the Server-side SSH For GitLab account
The SSH port is custom 2222.
 
 
5. If the connection is successful, the task icon appears in the task bar in the lower right corner.
 
 
3. Configure TortoiseGit
1. Select TortoiseGit-Setting from the start menu of windows, select Git in the dialog box, and enter info
Note: We recommend that the Name in User Info be consistent with your Gitlab account Name, and the account must have the git operation permission for the project, if not, the error permisson deny may be reported for GIT-related operations. of course, if you have just set up Gitlab, only the initial admin account of the system, and no other account is added, this permission issue will be ignored by the system.
Of course, another possibility is:
This is not mentioned in most domestic documents. It may be because windows 99.9% in Chinese people is in the Ghost version and is initially the highest admin permission. Therefore, the permission issue is ignored. However, if your windows system is in the home version, if you do not use the highest system permission to log in, the above error will occur. This problem was also found by a friend of mine, whose host is Win8 home edition of Surface, it is usually a common user login, So let me hold for a long time, and finally found the problem...
If you have git-related management experience, you can explain it here.
2. create a directory on disk D, such as "D: Git", and right-click the directory and select "Git Create repository here... ", click OK in the pop-up dialog box to create a local Git repository.
 
3. create a test project text file under the repository Directory, right-click the blank space in the directory, and select Git Commit-> "master "..., in the pop-up dialog box, enter the prompt comment, select the version control file to be added, and click OK to submit.

4. Now we only use Git to manage projects locally. If Success is displayed on this interface, the local submission is successful. Then click Push... to submit our changes to the Git server.
5. In the Push dialog box that appears, set the current branch name to master in the Ref-Remote column, and click the Manage button in the Destination-Remote column.
6. in the displayed settings dialog box, enter the server Remote name, URL (git@git.yanwenbo.cn: root/tesproject. git), the previously saved local private key testkey. ppk, click Add New/Save to Save the setting, and then click OK to exit the previous dialog box.
 
7. Final confirmation and submission
 
8. push successful
 
9. View the submission result in the background of Giblab.
 
Success...
 
 
Postscript...
Previously, we introduced how to use TortoiseGit and putty to connect to GitLab through SSH custom ports.
However, in the process of configuring a friend, I found that the SURFACE WIN8 system could not be pushed successfully, but my win7 method would be fine. Simply use the OPENSSH command line method.
The specific process is slightly changed here
1. Use git bash to create a key. The format of the key is basically the same as that of the linux command line.
A. The client generates the key
# Cd ~
# Ssh-keygen-t rsa
Press enter to generate a public key and key pair.
# Cat ~ /. Ssh/id_rsa.pub
-------------------------------------------------
Copy and paste all the Keys generated here to the gitlab web SSH Keys background and save them.
-------------------------------------------------
After upload, as shown in the following figure:
B. Test the SSH connection.
# Ssh-p22 git@git.example.com
If the following error is reported:
--------------------------------------
PTY allocation request failed on channel 1
/Usr/bin/env: ruby: No such file or directory
Connection to git.example.com closed.
--------------------------------------
Indicates that the ruby environment variable on the server is not in this directory/usr/bin/ruby
Add this soft link to the server:
# Ln-s/usr/local/ruby/bin/ruby/usr/bin/ruby
Note: If the server-side SSH custom port is used ~ Add port configuration under/. ssh/config
Assume that the custom SSH port is 2222
# Echo "Port 2222"> ~ /. Ssh/config
C. Reconnect
# Ssh-p22 git@git.example.com
--------------------------------------
PTY allocation request failed on channel 1
Welcome to GitLab, Anonymous!
Connection to git.example.com closed.
--------------------------------------
2. Change TortoiseGit's default SSH client TortoiseGitPlink (Putty) to openssh. The specific path is subject to your actual installation path.
3. Change TortoiseGit's key import path to the key path generated by the Git bash command line.
Change the following key path generated by PuttyGen in the previous configuration to the key generated by openssh.
I log on as a windows administrator account.
Therefore, the path is C: UsersAdministrator. sshid_rsa.
4. Keep other configurations unchanged. Follow the steps above to complete openssh authentication remote Git over SSH for Gitlab.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.