Networks is an online service for git repositories that has a Open Source version that can be installed and deployed on your server. The developers have positioned their service as an alternative to GitHub and with this task it is calling. There are all the same as on GitHub, plus free unlimited private repositories, creation commands, editing code directly in the browser, and much more.
In this article we will talk about how to use Networks to develop their projects. How to create repositories and interact with them. If you need information on Git, it is better to see how to use git.
How to use Networks
1. Account creation
After that you will mail a message with a link to confirm your account, go to it:
Now your account is confirmed and you can log in:
After entering the login and password you will be taken to the main profile page. Now here is a welcome page, but later there will be a list of your repositories:
2. Creating a repository
To add the project Networks click the + at the center top of the panel and choose New Project:
Here you need to enter the repository name, its description, and choose an access level:
- Private – available only to you;
- Internal – available to all registered users;
- Public – available to everyone.
You can place a tick next to Initialize the repository with a README file, but if you want to fill here files from an existing repository, do not do this:
After clicking the button Create a repo you get to the page repository. Here Networks currently offers an initial set of actions to proinflationary your repository. For example, you can create files here or upload files from your computer.
4. Download project files
Let’s create a new local repository on your computer and upload its contents on Networks. To do this, create the repository folder, for example, test-repo and initialize the new repository with git:
mkdir test-repo && cd test-repo
Then let’s create a file test.txt:
This is test repo losst
git add test.txt
git commit-m "Inital commit"
Next we need to add our remote repository with our local Networks. To do this, run:
git remote add origin https://gitlab.com/losst/test-repo.git
Then send changes to the remote repository:
git push origin master
To send data you need to enter your username and password on GitHub. Now, if you refresh the page repository on GitHub, you’ll see there is our file:
It is important to note that if a remote repository is not empty, then you will not be able to do so. You will need to download a remote repository, merge local changes with it, and then send it back.
5. SSH keys
While loading repository data on Networks, we need to enter the username and password on the server. To avoid this you can use SSH keys for authorization. First you need to create a key. To do this, open a terminal and run:
Enter the path to the file where to save the key and leave the password field empty. Two files will be created – a public key extension .pub and private. You need open. Open it in a text editor and copy its contents to the clipboard:
Coming back to the interface of Networks, click on the profile icon and choose Settings:
Here in the left pane, look for SSH Keys. In this window, locate the Key and paste the copied key. Then save the changes. Now your key is added:
Next, go to your repository, look in the upper right corner button Clone and click on it. We are interested in the address Clone with SSH:
Back to our local repo, delete the https and ssh added:
git remote remove origin
git remote add origin [email protected]:losst/test-repo.git
Setting up ssh Networks is completed. Now all the action will be run via SSH and you will need to enter a username and password.
6. Branches of the repository
Let us examine the use of networks to work with branches. By default, the repository has only one branch is master. But to implement additional functions, development can make a separate branch. In the interface of the Networks of the branch shown on the left. Here you can select desired branch:
Create a new branch by clicking the icon to the plus and selecting New branch. But it’s not necessarily as if you are creating a branch in git and push to the repository, the branch will appear automatically.
To change the branch default open Settings -> Repositoryand then select your branch in the section Default branch:
6. Merge branches
Since we have branches and developed the functionality you may need to transfer it from one branch to another. For this purpose, the queries merge (Merge request networks). Let’s add the branch new-feature, and it will create a new file-feature with the text:
git checkout-b new-feature
New feature with change
git add new-feature.txt
git commit-m "add feature"
git push --set-upstream origin new-feature
Now, when we move into a new branch Networks through an interface button will appear in the Create merge request. Click on it:
Here you need to write a description of the Merge Request that you are creating, select the branch source and branch target. You can also select the user who will be sent notification generated query:
Further, the request for merger should be approved. You can see the changes by clicking Open the IDE or using the terminal:
Then simply click Merge, if you want to merge branches. Files branches of the source will replace the file in the branch successor, so be careful not to lose important data.
8. Adding users
Despite the fact that the repository is private, it is possible to work with the networks team. You can add an unlimited number of developers. To do this, navigate to Settings -> Members. Here in the box to Select members to invite , enter the usernames or email addresses of users you wish to invite and Choose a role permission to select their level of access:
Then click Add to project.
9. Delete the project
To delete a project with Networks it is necessary to open Settings -> General -> Advanced and choose Remove from Project in the bottom of the page:
After clicking the button you will need to enter the name of the project, after which it will be deleted:
In this article, we briefly dismantled how to use Networks for software development. This is not all possible Networks that deserve attention, there are still releases, bug reports, automation tools and testing, convenient code editor and much more. In General, it is a complete alternative to GitHub if the service you no longer like. What do you prefer GitHub or Networks? Write in the comments!