Add Remote URL Git Repository via Command Line

Posted on

This is an article which is related with the concept of Git version control using Git package or utility. In the context of this article, it is used to define remote URL via command line. To be able to achieve or to be able to do the one specified in the title of this article, there are few steps taken before the actual command executed to define remote URL via command line an be performed. But first of all, the command involving ‘git’ command to define remote URL via command line is actually shown below :

git remote add repository-name [Repository URL]

Description : 
git : It is the command which is used to execute the git utility
remote : It is the available parameter added in executing git utility to specify a remote URL repository which is going to be operated or to be managed 
add : It is an additional operation which is defining to add an URL of a remote Git repository
repository-name : It is the name given as a reference for giving name to the remote Git repository which is going to be defined by passing the URL address fot the remote Git repository itself. 
[Repository URL] : It is the URL representing the address of a remote Git repository

Below is an example showing the execution of the above command pattern :

user@hostname:~/test$ git remote add test http://myuser@srv.app.repository/gitlab/myuser/test.git
user@hostname:~/test$

So, based on the above example, the repository named ‘test’ is added as a remote Git repository and the address of the repository is given in the last parameter.  After successfully adding the URL address of the remote Git repository server, prove whether or not it has been successfully added. To prove it by checking whether the remote URL address has already successfully added, just read the article titled ‘Git Check Remote URL via Command Line’ in this link. Below is how we check it based on the article mentioned before :

user@hostname:~/test$ git remote -v
test http://myuser@srv.app.repository/gitlab/myuser/test.git (fetch)
test http://myuser@srv.app.repository/gitlab/myuser/test.git (push)
user@hostname:~/test$

 

Leave a Reply