Git Hub Question(s)

Thanks! Yeah im still learning these things. Ive made Git Hub commits and repos and such but I haven’t done much locally with git yet.

Its alot to learn. Do you have any advise on learning Git? Any tips would be appreciated :pray:

1 Like
  1. Git Pro was a good free book I half read.
  2. Consciously using Git in your day to day projects even though you are fully aware that it may make you less productive in the short term.
  3. Making the steady long term use of git a challenge by setting goals or friendly competitions like keep your GitHub green.

Hope that helps

1 Like

Ok guys I messed something up :sob: does anyone know what this green highlighting is? I have no idea how to get rid of this.

I was trying to push this entire project up to GitHub. Ive done it before but IDK what happened this time :triumph: Im bad at this.

I GOTTA start doing this.

The reason you would want to use Git and GitHub is that it’s best practices. It will teach you the ability to work in a team environment. Get used to creating repositories on GitHub and pushing up your code. Making branches and merging them using Jenkins to build the CI/CD pipelines. In my experiences, I had gone through a bootcamp and also the Rails Tutorial book series and both of those taught me the reason to use Git and GitHub to create backups of my code. Kind of like a checkpoint in a game. If you make a mistake and need to go back you have several checkpoints created in your games so you aren’t stuck on a part you can’t get past because of a mistake you made.

The use of GitHub through the GUI that VS Code offers isn’t a bad idea. I use it daily at work and it’s great. I still use the Git commands in my terminal when I need to clone a repo or pull the code but pushing and creating branches I use VS Code. I also use the terminal when I need to delete or remove a branch. It’s extremely useful to know. As without these skills a lot of hiring managers or lead developers won’t consider you because they will think you don’t have any team experience or ability to collaborate with a team. I was told this before I started using Git heavily. So it’s definitely worth learning whether it is with VS Code or the terminal.

2 Likes

Got it. Im working on learning the process now.

For some reason its always confused me. Do you have to make a Git repository locally and commit those files first before pushing to your GitHub repository?

I usually go the other way around - making a remote Git repo and pulling it down to local.

1 Like

Well wouldn’t you have the files local first? and then push them up into remote?

Thats what im trying to do.

You don’t need to have any files to create the remote repo. I’ve personally never had much luck creating the repo locally and then pushing it to a remote that does not yet exist.

1 Like

At the moment im trying to figure out how to push a practice project into GitHub via the terminal and its not going to well.

Do you need to make a commit first or something?

Totally lost.

So typically what happens is that you need to initialize the project by running git init. I typically create a repo on GitHub first then follow the steps that they give you in order to connect your GitHub Repo to your local project.

Usually I

  1. create the repo on GitHub
  2. clone the repo locally
  3. copy my initial files into the cloned repo
  4. commit my initial files
  5. push from local to remote

for some reason when I try to push the files it says permission denied… :thinking:

You have already created the remote repository and are pushing to it with the correct credentials?

Ive created the repo but I just can’t push into it. maybe my ssh key got messed up?

That or you are not pushing to the correct remote repo

Ive ssh’ed into another machine. But since then I rebooted my computer. Could that be the problem? I can imagine that that would change my original ssh…

I find that to be unlikely. What commands are you attempting to use? In what way did you create your remote and local repositories?

Well first, I made a repository in GitHub with plans to push my local files into that repository.

then in VS Code, I used the given instructions on GitHub -

git init
git add README.md
git commit -m “first commit”
git branch -M main
git remote add origin git@github.com:tuscannyCodes/PracticeRwpo1.git
git push -u origin main

once I get to the final step which is git push -u origin main, I get this error -

No such file or directory
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.

but the file and directory does exist and Ive clearly already added the remote :thinking:

This sort of difficulty is why I instead

rather than using git init.

1 Like

Why not use HTTP instead of SSH?

I use SSH, but it always proves a pain to set up. If you absolutely want to use SSH, be sure to follow the GitHub SSH Docs.

Hope this helps

2 Likes