Setting up github on gitpod

I followed the instructions on the page that was set up on using Gitpod With The Curriculum and tried to connect to the get repo that I set up on the Github website. However I’m getting a public key error. How do I correct this?

Do I need to generate a key?

The authenticity of host 'github.com (20.29.134.23)' can't be established.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

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

Do I need to add .global username and email?

Different error now

Enumerating objects: 312, done.
Counting objects: 100% (312/312), done.
Delta compression using up to 16 threads
Compressing objects: 100% (134/134), done.
Writing objects: 100% (312/312), 88.26 KiB | 22.07 MiB/s, done.
Total 312 (delta 233), reused 192 (delta 167), pack-reused 0
remote: Resolving deltas: 100% (233/233), done.
remote: fatal: did not receive expected object 47b1425f961cc1246fad8af27fe299f28863d019
error: remote unpack failed: index-pack failed
To https://github.com/mygithubname/fivebashprograms.git
 ! [remote rejected] main -> main (failed)
error: failed to push some refs to 'https://github.com/mygithubname/fivebashprograms.git'```

Hello there,

I have never seen that error on Gitpod.

The only time I have seen that permission denied error is when working on a network blocking certain hosts/proxies.

Would you mind sharing the steps you took before getting those errors?

I followed the tutorial set out in How To Use GitPod with This Curriculum. I went to my github and created a new public repo. I changed the permissions in the GitPod settings to allow public repos. Ran the commands to establish the remote origin url and checked it with a git remote -v. Created the main branch and tried to run a push and thats when I got that error

I will CC @moT01 on this, in case he has come across something similar.

Otherwise, my best suggestion is something like:

rm -rf .git
git init
git remote set-url origin https://github.com/<github-username>/<repository-name>.git
git branch -M main
git push -u origin main

Actually, writing that brings to mind that the git branch -M main step is probably not recommended for any of the Relational Database curriculum, because it is already initialised as a Git repo with main as the master branch.

So I don’t have to sign in to anything within the git pod to connect it to the github account or set the global variables ?

Sometimes you need to sign in to GitHub:
image

You could manually configure Git to have the permissions to write to your account, but you would then need to do this for every workspace. You would do this by following GitHub’s docs: About authentication to GitHub - GitHub Docs

Is there another option beyond the manual way? I mean I’d like to continue on with the course I’m on (Bash Scripting) and I’d also like to back things up to my Git Repo.

Yes:

Hope this clarifies

So, it sounds like you just want to push the files you created from the course to your own repo.

I had the same error when I tried to do what you did. Something with CodeRoad or Gitpod not letting it push to GitHub maybe, I’m not sure. Anyway, there’s a lot of files for the course in the /project folder that you really don’t need in your repo. Here’s what I did that worked. Note that you should do this after you complete the entire course or the files won’t be in the right place to work on the course.

Create a new directory
Move all the files you want in your repo into the folder
Change to the new directory and git init to make a new repo
git checkout -b main to create/switch to main branch
git remote add origin your-repo.git
git add . to add the files to staging
git commit -m "message"
git push origin main

Something like that anyway.

So I wiped out the pod and just restarted the thing from scratch. I only did the git remote add URL part and when I went to push I only pushed the .sh file I created and that seemed to work out fine.

1 Like

So related but separate question. My commit messages don’t show on github but instead it shows a Save Progress. Any ideas on how to change it show it shows the actual commit messages?

If you link the repo, I could take a look to try and give some more info. CodeRoad loads and makes commits, that’s how it progresses through the course. Adding/changing branches and making commits on your own could interfere with the course. The Save Progress commit is created by CodeRoad after each step you finish.

Different question and I’ll start a new thread if needed… I opened up a pinned gitpod workspace to finish up the Create 5 programs for learning bash… and the Class based material reverted to the beginning of the whole course. How do I get it back to where I left off without having to go through doing all the things again. Additionally, I told it to do a reset which removed the files I had done from the /project folder. They are on my repo, but I can’t seem to get it to pull them back down because it says the branches diverged… not sure I want to rebase… but I DO NOT want to start all over.

Like I said, messing with git in the middle of course could cause problems with the course. I would not recommend it.

You could look at the thread here: CodeRoad - Build a Kitty Ipsum Translator - #5 by pkdvalis - some others have been taken to the first step and were able to get back to where they left off after restarting the workspace again.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.