Additionally, users can add the βHTTPsβ or βSSHβ protocol according to their preference. However, compared to the HTTPs protocol, SSH is the secure way of connecting the local repository with the GitHub hosting server. Moreover, developers can add the SSH port as per requirements.
This guide has elaborated on adding a Git remote with another SSH port.
How to Add Git Remote With Other SSH Port?
Follow the below-listed steps to add the Git remote with another SSH port:
- Move to the Git repository.
- Check the list of remote URLs.
- Open the GitHub hosting server and copy the desired remote repository SSH URL.
- Switch to the Git terminal and execute the βgit remote addβ command along with the SSH URL and desired SSH port.
Step 1: Navigate to Git Local Repository
First, utilize the βcdβ command and switch to the specified repository path:
Step 2: View Tracking Remote Repository URLs
Then, execute the βgit remoteβ command and check the remote URLs:
According to the below-given output, the remote URL list is empty:
Step 3: Copy GitHub Repository URL
Now, go to the GitHub hosting server, and open the desired remote repository. Then, navigate to the βCodeβ button sub-menu, click on the βSSHβ URL, and copy it to the clipboard:
Step 4: Add Remote URL With SSH Port
Next, execute the provided command along with the copied remote repository path:
In the above command, β2224β is the SSH port:
Step 5: Ensure Added Remote URL
Lastly, ensure the tracking remote is added or not by running the below-listed command:
It can be observed that the provided SSH URL along with another port number has been added successfully:
That’s all! We have compiled the easiest way of adding the SSH remote URL along with the desired SSH port.
Conclusion
To add the Git remote along with another SSH port, first, move to the Git repository and check the list of remote URLs. Next, open the GitHub hosting server and copy the desired remote repository SSH URL. Then, switch to the Git terminal and run the βgit remote addβ command along with the SSH URL and desired SSH port. This guide has elaborated on adding a Git remote with another SSH port.