1

I have two branches in our repository.

 master
    dev

I got checkout from my dev branch. (#git checkout -b origin/dev) And I did some development locally. I want to commit that changes to that dev branch. I tried.

#git add .
#git commit -m "aa"
# git push

But getting fatal error. repository 'https://github.com/lobdev/eps-portal.git/' not found

When trying status

# git status

I get

On branch dev
Your branch is ahead of 'origin/dev' by 2 commits.
  (use "git push" to publish your local commits)
nothing to commit, working directory clean

How can I commit to the dev branch?

I tried ;

 #git remote show origin

And getting;

* remote origin
  Fetch URL: https://github.com/lobdev/eps-portal.git
  Push  URL: https://github.com/lobdev/eps-portal.git
  HEAD branch: master
  Remote branches:
    dev    tracked
    master tracked
  Local branch configured for 'git pull':
    dev merges with remote dev
  Local ref configured for 'git push':
    dev pushes to dev (fast-forwardable)
Ratha
  • 9,434
  • 17
  • 85
  • 163
  • Is your repository on GitHub private? Are you able to run `git fetch` without error? – Ry- Aug 15 '17 at 01:09
  • check your git url.: git remote -v – Tim Aug 15 '17 at 01:22
  • @Tim . I modified my question too. I have two branches in git repository. Master and dev. Here is what I see; git remote -v origin https://github.com/lobdev/eps-portal.git (fetch) origin https://github.com/lobdev/eps-portal.git (push) – Ratha Aug 15 '17 at 01:27
  • @Ryan git fetch didnt give any errors. I modified my quetsion too. I have two brances in git repository. Mastr and dev – Ratha Aug 15 '17 at 01:28
  • Possible duplicate of [Git Push ERROR: Repository not found](https://stackoverflow.com/questions/10116373/git-push-error-repository-not-found) – Chris Halcrow Aug 15 '17 at 01:30
  • @ChrisHalcrow no mine different – Ratha Aug 15 '17 at 01:31
  • Looks like your `origin/dev` branch has some other commit on the top which you do not have on your local branch. `git fetch origin` and use next command to find the missing commit `git log origin/dev ^dev`. If you see any commit, then you can rebase your branch to get the latest changes from `origin/dev`. You can rebase your branch as `git rebase origin dev` and they try pushing the changes. – Rishikesh Darandale Aug 15 '17 at 01:56
  • @RishikeshDarandale Here are the outputs.(Note: Im the only one working on dev branch) #git fetch origin (NO OUTPUT) yy-portal ratha$ git log origin/dev ^dev(NO OUTPUT) – Ratha Aug 15 '17 at 02:06
  • little confused as to what your url should. be. lobdev/eps-portal.git or lyy/yy-portal.git. i suspect you need to correct your remote url. git clone followed by git fetch origin master and git checkout -b dev should have gotten your master branch down and created a dev branch from it. "git checkout dev" : make changes, then "git add --all" , 'git commit -m "msg"' && "git push -u origin dev" : should have pushed your dev branch with changes back up (only use -u switch the first push). Did you do this? Or did you fork the branch and clone the fork? – Tim Aug 15 '17 at 04:00
  • @Tim, In the question i provided correct URLs(earlier i edited with artbitary strings). URL is not an issue. I believe committing to a branch(ie:dev) is different way than committing to master ? – Ratha Aug 15 '17 at 04:07
  • 3
    @Ratha, looks like you do not have permission to push to this repository. Either get the required access or try forking this repository and push your changes to your fork. Then raise a `pull request` to main repository. – Rishikesh Darandale Aug 15 '17 at 04:29
  • 1
    @ratha no, committing to dev and pushing won't be different from master. And you are not getting a 403, so i do not suspect its a permissions issue. Please review the steps i mentioned. interested to see 'git status', to see what state your local dev branch is in. – Tim Aug 15 '17 at 04:42
  • @RishikeshDarandale Thanks forked and committed it works. Sorry Im new to git, never worked on a branch. – Ratha Aug 15 '17 at 04:44
  • @Tim I forked the branch and commited as Rishikesh told. It works. I try your too. – Ratha Aug 15 '17 at 04:45
  • 1
    Ok, cool. Check the documentation on setting upstream. So if using a fork, you dont really need to make a dev branch, you can use master of your fork. Or you can make a branch, doesnt matter. But you want to make it a habbit to merge upstream/master into your fork master, so your fork stays current. Then you make your changes, commit, push.. and do a pull request when ready for the app owner to merge your fork master (or dev) back into the main repo – Tim Aug 15 '17 at 04:48
  • 1
    https://help.github.com/articles/configuring-a-remote-for-a-fork/ – Tim Aug 15 '17 at 04:49
  • @Tim Thanks a lot. Will follow the best practices. – Ratha Aug 15 '17 at 04:52

1 Answers1

-1

Show all remotes:

git remote show

Inspect a remote:

git remote show origin

The remote url might be wrong (sometimes it's renamed to a different url).

Remove it:

git remote remove origin

Add updated url:

git remote add origin something.git
linden2015
  • 887
  • 7
  • 9
  • I have added few more details in my original question. Please check – Ratha Aug 15 '17 at 01:30
  • git remote show origin gives following; $ git remote show origin * remote origin Fetch URL: https://github.com/lobdev/eps-portal.git Push URL: https://github.com/lobdev/eps-portal.git HEAD branch: master Remote branches: dev tracked master tracked Local branch configured for 'git pull': dev merges with remote dev Local ref configured for 'git push': dev pushes to dev (fast-forwardable) (I have edited my question with more information) – Ratha Aug 15 '17 at 02:10
  • I do not want to remove origin . I want to update the dev branch – Ratha Aug 15 '17 at 02:17