I have setup ssh profile on my Ubuntu Machine and it is working fine as well.
Today, my other friend created new branch and pushed the code and branch on heroku.
Now, the problem is that I can't able to pull new branch on my local.
Below are my commands:
u#u:~/workspace/abc$ git pull heroku upgrade:master
fatal: Couldn't find remote ref upgradeu#u:~/workspace/abc$ fatal: The
remote end hung up unexpectedly
And if I do git fetch it shows no response.
My git config is:
[color]
ui = true
[user]
name = user
email = user#gmail.com
[core]
autocrlf = input
[push]
default = simple
[http]
postBuffer = 157286400
my ssh profile:
Host heroku.work
IdentityFile ~/.ssh/id_rsa_abc
Hostname heroku.com
User user#gmail.com
IdentitiesOnly yes
My remote is:
[remote "heroku"]
url = git#heroku.work:abc.git
fetch = +refs/heads/*:refs/remotes/origin/*
You wouldn't normally pull another branch. You would switch to it
Run git pull heroku to update your local repository from the remote
Then use git branch to display the available branches
Lastly use something like git checkout update to switch to the branch.
Related
I am having some problems with bitbucket. All my project folders and files are uploaded except the src folder. The src folder in my computer has files and folders. But it is not appearing in bitbucket. Why is the src folder appearing like that in bitbucket?
I enter the commands:
git init
git add .
git commit -m "initial commit of full repository"
git remote add origin
https://boidurja#bitbucket.org/boidurja/kapstone.git
and I get this error:
F:\BOP consultancy and services\vuetify project\kapstoneui>git remote add
origin
https://boidurja#bitbucket.org/boidurja/kapstone.git
fatal: remote origin already exists.
And I enter this command:
git push -u origin --all
and I get this error:
F:\BOP consultancy and services\vuetify project\kapstoneui>git push -u
origin --all
To https://bitbucket.org/boidurja2/kapstone.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to
'https://boidurja2#bitbucket.org/boidurja2/kapstone.git'
hint: Updates were rejected because the remote contains work that you do not have locally. This is usually caused by another repository pushing to the same ref. You may want to first integrate the remote changes hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Can anyone help?
Created a repository on bitbucket. Trying to "push up" to the repository, though am unsure exactly what that means?
Also, and more importantly, I get an error when trying to execute two lines:
$ git remote add origin git#bitbucket.com/addyd/toy_app.git/src/master
fatal: remote origin already exists.
Addy#DESKTOP-6L1EGSI MINGW64 /c/Sites/environment/toy_app (master) $
git remote add origin git#bitbucket.com/addyd/toy_app.git/src/master1
Any help?
what it returned if enter the command git remote -v
if there is already a git remote origin exist it will print something like
origin https://bitbucket.com/addyd/toy_app.git(fetch)
origin https://bitbucket.com/addyd/toy_app.git(push)
if it is already there and pointing to the right repository do ACP
git add .
git commit -m "commit message"
git push origin branch
The right command to update change origin would be:
git remote set-url origin ssh://git#bitbucket.org/addyd/toy_app.git
But you shouldn't need to update origin if it was set before, and if you cloned successfully that repo: add some commits, and then:
git push -u origin master
I've changed my name on GitHub and try to push my application.
I tried to push after git add and git commit, but it didn't work.
I deleted my repository and now I try to create a new repository, but git doesn't know about my new name:
dartnyan#PC:~/Projects/sample_app$ git remote add origin
https://github.com/NyanTyrrell/sample_app.git
fatal: remote origin already exists.
dartnyan#PC:~/Projects/sample_app$ git push -u origin master
Username for 'https://github.com': NyanTyrrell
Password for 'https://NyanTyrrell#github.com':
remote: Repository not found.
fatal: repository 'https://github.com/newDartNyan/sample_app.git/' not found
How can I change the path from /newDartNyan/ (old name) to /NyanTyrrell/ (new name)?
Using the option set-url of the remote command as such.
git remote set-url origin https://github.com/NyanTyrrell/sample_app.git
This will change the remote URL to the value provided, in this case https://github.com/NyanTyrrell/sample_app.git.
I have a local rails app that is a local git repo. I want to push that to my remote webserver and than be able to push changed files to that.
I tried just transferring all the files over via SCP and then on my local run a git clone ssh://... but when I try to push files from local to remote I get the [remote rejected] master -> master (branch is currently checked out) error.
All the stack questions around this error don't work for me (i.e. I can push but no files actually show up on the remote server, or I still get the error).
How do I set it up so that I can
a) push files from local to remote
b) have a full copy to run the rails server from on the remote?
EDIT: cloned repo .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = ssh://10.1.150.24:/home/mwerner/dashing/.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
for ssh access:
git clone git+ssh://remote_pc/path_to_folder
for gaccess to a git-server:
git clone user#server:path/to/git/repo
for github:
git clone git#github.com:user/repo
I was using a github repository from a previous developer.
I am the only coder on this project, so I forked the project over to my own github repository.
Now I would like to commit soley to my repo.
Unfortunately, I realized that I never changed my .git/config , so I was still committing to the old repo. I just changed it to the appropriate url, and when I type :
$> git status
It returns :
=> Working directory clean.
But I know its not because I have several commits I've made. So my local box has different code then what it is pointed to on my repository.
My question is this. Obviously I'm halfway through the process of doing this. Do I need to re-fork to update, and then I'm good. Or is there a special command I need to run to let my local box know its 'git status' command is targeting a new repo to compare itself to? Equally, am I missing something else very important :D ?
Thank you everyone.
You can use git remote to manage your remote
rename origin
git remote rename origin old_origin
add a new origin
git remote add origin git://github.com/my/forked/repo.git
git fetch origin # will create all the remote branches references
# in your local repo
You can also easily setup a new upstream for your current master branch (git 1.7 and more):
git branch --set-upstream master origin/master
The "nothing to commit (working directory clean)" message of git status won't prevent you to push.
After changing the origin, you should see:
$ git status
# On branch master
# Your branch is ahead of 'origin/master' by xxx commits.
#
nothing to commit (working directory clean)
That means you have some commits to push to your new origin.
Note: "git remote"(man) rename failed to rename a remote without fetch refspec, which has been corrected with Git 2.39 (Q4 2022).
See commit 5a97b38 (22 Sep 2022) by Jeff King (peff).
(Merged by Junio C Hamano -- gitster -- in commit 20a5dd6, 10 Oct 2022)
remote: handle rename of remote without fetch refspec
Reported-by: John A. Leuenhagen
Signed-off-by: Jeff King
We return an error when trying to rename a remote that has no fetch refspec:
$ git config --unset-all remote.origin.fetch
$ git remote rename origin foo
fatal: could not unset 'remote.foo.fetch'
To make things even more confusing, we actually do complete the config modification, via git_config_rename_section().
After that we try to rewrite the fetch refspec (to say refs/remotes/foo instead of origin).
But our call to git_config_set_multivar() to remove the existing entries fails, since there aren't any, and it calls die().
We could fix this by using the "gently" form of the config call, and checking the error code.
But there is an even simpler fix: if we know that there are no refspecs to rewrite, then we can skip that part entirely.
git status only shows you the status of your working directory, not the entire repository. It seems like you only need to change the remotes that git push and git pull use by default. Open up .git/config and find your branch.<branch> entries and change them, as well as your remote.<remote> entries. For example, your master entry may look like this:
[branch "master"]
remote = origin
merge = refs/heads/master
Just change remote to reference your (forked) remote.
Also, your remote entry may look like the following:
[remote "myremote"]
url = git://github.com/me/repo.git
fetch = +refs/heads/*:refs/remotes/origin/*
You can add a push entry so that your master branch is pushed by default:
[remote "myremote"]
url = git://github.com/me/repo.git
fetch = +refs/heads/*:refs/remotes/origin/*
push = master
In whole, but I should include it in this answer. Is that before hand I manually altered my .git/config to include my new repository url. That's why I didn't have to rename or add any origin as Von suggested.
Then I just guessed this and performed
$> git fetch origin
Which returned
From git#github.com:gotoAndBliss/hq_channel
17326ca..043d395 master -> origin/master
* [new branch] panda_streaming -> origin/panda_streaming
+ 6ec9bf8...becbcc6 testing -> origin/testing (forced update)
Then on git status I got
# On branch testing
# Your branch is ahead of 'origin/testing' by 9 commits.
I git pushed origin testing, and I think I'm on target now.