Cloning a Project Repo to Work On
Cloning a project repo that you are going to work on requires you to have write access to the it, which means you must have a public-private key pair setup if using
ssh, which you always should.
But First …
You need to have a project repo created or forked from another before you can clone it.
Step by Step
Navigate into your repos directory.
cd cd repos
Now all you need to do is change the following to match your account and the path of your project repo.
💎 You can save time by cutting pasting the SSH URL in GitLab. Click on the blue Clone button to get it.
If you are cloning something in your personal account (not a group / organization), then do something like this (using your own info).
git clone email@example.com:robmuh/myproj.git
If you are cloning something from your group or sub group it might look like one of the following:
git clone firstname.lastname@example.org:skilstak/grouproj.git git clone email@example.com:skilstak/config/vim.git
❤️ I absolutely love the ability only GitLab gives you to organize your many project repos under subgroups. GitLab really is objectively superior to GitHub in many ways..
You might see something like this if it is your first time cloning a brand new project repo and you haven’t put anything in it.
Cloning into 'www'... warning: You appear to have cloned an empty repository.
If you see something like this you have cloned an existing project repo with something in it already.
Cloning into 'www'... remote: Enumerating objects: 12, done. remote: Counting objects: 100% (12/12), done. remote: Compressing objects: 100% (8/8), done. remote: Total 12 (delta 1), reused 0 (delta 0) Receiving objects: 100% (12/12), done. Resolving deltas: 100% (1/1), done.
You can change into this directory now and work.
For example, if the project is
www you would do this:
cd www pwd
If you are using VSCode then you can reset it to this directory.
code -r .
code means VSCode.
-r does the resetting. Don’t forget it. Actually it means reuse but who cares. Just always use it anyway.
. means “this directory right here that I’m in currently.”