DEV Community

anatlavitzkovitz
anatlavitzkovitz

Posted on

osdc-2023-assignment5

How to make my own repository and edit it locally?

Unfortunately I missed lesson 4, but I was in Amsterdam so at least had some fun.
I decided to make my own R plot repository in GitHub, as I use R a lot and many times I repeat my code. I think this could be useful although I am sure there are many similar repositories.

How?
I wrote a first piece of R code and put that in a linux server which have R installed. I wrote a short R script and saved it, and did:

git status
git add 'main.R'
git commit -m "my first script in my new R rep0"

Enter fullscreen mode Exit fullscreen mode

Now I went to GitHub and opened a new repo.

back to the remote I wrote:

git remote add origin git@github.com:anatlavitzkovitz/visualization_with_R.git
git branch -M main
git push -u origin main

Enter fullscreen mode Exit fullscreen mode

but...
Permission denied (publickey).
fatal: Could not read from remote repository.

oh.... I forgot to add the ssh key to my GitHub keys.
After doing that (explained in more details here)- it worked.

I added a README file via GitHub with some details. It still needs a lot more work but I hope to add some more details and code soon.

##########

How to clone and make local changes to another open source project?

I entered some of my colleagues Shuly's repo
and Adi's repo and added
some issues.

now I want to make some pull requests to my friend's repos @shulyavraham:

git clone git@github.com:ShulyAvraham/LIMS_results_validation.git
git checkout -b addrequirements

Enter fullscreen mode Exit fullscreen mode

Now add some changed such as:
added #test to requirements.txt (not a very useful package..)

git add requirements.txt
git commit -m "updated requirements.txt"
git push

Enter fullscreen mode Exit fullscreen mode

ERROR: Permission to ShulyAvraham/LIMS_results_validation.git denied to anatlavitzkovitz.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

ha ha... I need to make my fork and than a pull request from there!

I went to Shuly's repo
and made a fork. back to my remote now:

git remote add fork git@github.com:anatlavitzkovitz/LIMS_results_validation.git

git remote -v
fork    https://github.com/anatlavitzkovitz/LIMS_results_validation (fetch)
fork    https://github.com/anatlavitzkovitz/LIMS_results_validation (push)
origin  git@github.com:ShulyAvraham/LIMS_results_validation.git (fetch)
origin  git@github.com:anatlavitzkovitz/LIMS_results_validation.git (push)

git push --set-upstream fork addrequirements

Enter fullscreen mode Exit fullscreen mode

now I have a pull request in my fork. send to Shuly!

Top comments (0)