Sorry, you do not have permission to ask a question, You must login to ask a question.

Sorry, you do not have permission to ask a question.

brainchime.com

brainchime.com

brainchime.com Navigation

  • Home
  • About Us
  • Contact Us

Mobile menu

Close
  • Home
  • Categories
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags

brainchime.com Latest Questions

Admin
Admin
Asked: October 5, 20242024-10-05T18:23:48+05:30 2024-10-05T18:23:48+05:30In: GitHub

How can I push to my fork from a clone of the original repository in GitHub?

I created a fork of another repository namely javacode (https://github.com/Originalusername/javacode) on GitHub and the forked repo is created under my user name(https://github.com/Myusername/javacode).

After that, I decided to clone the forked repo under my user name so that I could make changes to it and commit and push in my forked repository instead of the original repository since GitHub is an open source but I don’t have access to make changes to the original repo as it is owned by someone else. I can later request for PULL to pull my changes to the original owner/author of the repo.

Therefore, to clone my forked repo to my local machine for making changes, I opened git bash on the Windows machine as git is installed on my machine and runs the command git clone https://github.com/Myusername/javacode.git.

I got this forked repo URL from Github -> Under my forked repo -> click on <> Code -> Under HTTPS –> Copy the URL to clipboard and run the above command git clone forkedrepoUrl.

After the repo was cloned, I opened it using Intellij from the path of the cloned repo on my Windows PC. Make some changes to one of the files and on that changed file perform a right-click, select the option Git from the menu, and then select the Commit option to commit my changes first to the local cloned repo.

Alternatively, you can commit by running commands git add and git commit respectively on git bash also.

However, when I tried to push the changes to my forked repo on GitHub by performing a right-click on the changed file and selecting the option Git from the menu and from there selected Push option this time to push my changes to the forked repository.

Alternatively, you can push by running the command git push on the git bash.

I got this error,

remote: Permission to originalusername/javacode.git denied.
fatal: unable to access 'https://github.com/originalusername/javacode.git/': The requested URL returned error: 403

I tried several times but got this error again and again. How could I push my changes to the fork repo rather than to the original repo, where I don’t have access to write anything? I can only raise a pull request to the original author later to merge my changes to their original repo after reviewing my changes.

comman-line
  • 0
  • 0
  • 11
  • 6
  • Share
    • Share on Facebook
    • Share on Twitter
    • Share on LinkedIn
    • Share on WhatsApp
Leave an answer

Leave an answer
Cancel reply

Browse
Browse

Choose from here the video type.

Put Video ID here: https://www.youtube.com/watch?v=sdUUx5FdySs Ex: "sdUUx5FdySs".

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Admin
    Admin
    2024-10-05T18:31:24+05:30Added an answer on October 5, 2024 at 6:31 pm

    First, open the command prompt on your Windows machine. Navigate to your folder where you want to clone the forked repo assuming you have forked the original repo under your username. Suppose, you want to clone the fork repo to the desktop of your Windows PC then you execute cd desktop to navigate to the desktop.

    After that run the git clone fork-repo-url to clone the fork repo to the local Windows machine.

    git clone https://github.com/myusername/javacode.git

    this command will start cloning your fork repo on your desktop and will show the output like this on the command prompt.

    Cloning into 'javacode'...
    remote: Enumerating objects: 845, done.
    remote: Counting objects: 100% (461/461), done.
    remote: Compressing objects: 100% (157/157), done.
    remote: Total 845 (delta 325), reused 304 (delta 304), pack-reused 384 (from 1)
    Receiving objects: 100% (845/845), 8.24 MiB | 11.34 MiB/s, done.
    Resolving deltas: 100% (387/387), done.

    Once cloning is done, you can then run dir to see if the clone directory is created on the desktop. If created then run cd javacode to navigate to your cloned folder. Once you are in your cloned folder run the command dir again to see files cloned from the Github fork repo inside your desktop clone folder.

    After cloning, we need to set up a remote by running the following command on cmd.

    git remote -v

    This will list out the origin of the remote for this project which is from the fork.

    origin https://github.com/myusername/javacode.git (fetch)
    origin https://github.com/myusername/javacode.git (push)

    Now, set up a remote to the main remote repo which allows syncing of the fork repo with the main repo. for this, we need the URL of the original repo.

    You can get this main original repo URL by clicking on the link after your “repo forked from the link” and there under Code –> under HTTPS -> copy the original repo URL to the clipboard.

    Now under the command prompt window type the command to add remote to the main original repo.

    git remote add upstream https://github.com/Originalusername/javacode.git

    after this run this command again on the command prompt,

    git remote -v

    This will now list the fork repo as the origin and the original repo as upstream.

    origin https://github.com/myusername/javacode.git (fetch)
    origin https://github.com/myusername/javacode.git (push)
    upstream https://github.com/originalusername/javacode.git (fetch)
    upstream https://github.com/originalusername/javacode.git (push)

    Now try to open this cloned project on IntelliJ make changes commit and push to your fork repo it will be successful and you will be able to see your changes inside the GitHub forked repo. Now, if you want, you can request the original author to pull your changes using a pull request on GitHub.

      • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp

Sidebar

Statistics

  • Questions 143
  • Answers 177
  • Comments 0
  • Popular
  • Answers
  • Admin

    Why do we use OVERLAY keyword in data structure subfields ...

    • 12 Answers
  • Admin

    How to call sql stored procedure with output parameter from ...

    • 6 Answers
  • Admin

    How to use declare global temporary table statement in RPGLE?

    • 5 Answers
  • Admin
    Admin added an answer CPF4131 is a record format level check error. This indicates… October 18, 2024 at 1:58 am
  • Admin
    Admin added an answer To open the command prompt with administrator rights you can… October 17, 2024 at 12:27 am
  • Admin
    Admin added an answer In AS400, "AS" stands for Application system. This article discusses… October 13, 2024 at 12:49 pm

Trending Tags

.htaccess (1) as400 (123) bing-webmaster (2) control-language (12) db2 (33) ftp (8) google-adsense (1) google-search-console (3) https-redirect (1) iasp (4) ifs (22) jar (4) operations (3) php-my-admin (1) qshell (3) robots.txt (4) rpg (26) stored-procedure (3) stroed procedure (1) triggers (1) yoast (4)

Explore

  • Home
  • Categories
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags

Footer

BrainChime

BrainChime is a blog that posts question-and-answer-based format articles on diverse topics and engages in discussions by allowing people to provide answers/comments without the need to register and log in.

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Terms of Use
  • Privacy Policy
  • Cookie Policy

Help

  • FAQs
  • Categories
  • Tags

© 2024 BrainChime. All Rights Reserved
by BrainChime.

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.