git-push

remote: GitLab: You are not allowed to push code to protected branches on this project

浪子不回头ぞ 提交于 2019-12-13 11:56:43
问题 I am trying to push to master branch of a repo and I am failing to do so, since it is protected. I tried to look into the project settings and do not see any option for protected branches. The only option I could see is members. remote: GitLab: You are not allowed to push code to protected branches on this project. To git@gitlab.ins.risk.regn.net:cmd/release.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'git@gitlab.ins.risk.regn.net

Why does -u mean remember for git push [-u]?

China☆狼群 提交于 2019-12-13 10:37:59
问题 In the manual it states that -u will tell git to remember where to push to. However, I think this is a strange abbreviation. -r would make more sense. It works fine I'm just wondering where these abbreviations come from. 回答1: it means --set-upstream and that means: git push --set-upstream sets the default remote branch for the current local branch. (see this answer) 来源: https://stackoverflow.com/questions/34862779/why-does-u-mean-remember-for-git-push-u

After push, git says everything up to date but changes are not in the repo

妖精的绣舞 提交于 2019-12-13 06:59:55
问题 I'm pretty new to using Git, so maybe I'm doing something basic wrong. What I'm trying to do is push the commits of a branch to the remote repo on Github. I tried the following line git push origin Interface It returns 'Everything up-to-date', but when I check the branch on Github, my changes aren't there. What am I doing wrong? 回答1: Before you push make sure that files are added to the index and changes have been committed. Its a good practice to commit with a message. In case you did not

Force “git push” to overwrite remote files

↘锁芯ラ 提交于 2019-12-13 04:04:34
问题 I want to push my local files, and have them on a remote repo, without having to deal with merge conflicts. I just want my local version to have priority over the remote one. How can I do this with Git? 回答1: You should be able to force your local revision to the remote repo by using git push -f <remote> <branch> (e.g. git push -f origin master ). Leaving off <remote> and <branch> will force push all local branches that have set --set-upstream . Just be warned, if other people are sharing this

Recovering file history after a forced push

那年仲夏 提交于 2019-12-13 02:36:05
问题 I just tried to migrate my files for a certain repository on my local machine to another directory and appear to have failed miserably. Having copy-pasted the source files to a new folder, I went through the following to try and make a commit to the original GitHub repository by doing the following in the new directory: git init git add . git commit -m 'migration' git remote add origin https://github.com/UN/REP.git git push origin master This (as I've grown used to with git by now) threw me

Confirmation of git push command

半城伤御伤魂 提交于 2019-12-12 22:09:52
问题 How I can configure some confirmation on git push command in concrete branch? I have production branch and sometimes I forgot that I in production branch and push not those changes. 回答1: One potential solution would be to remove the config associated with 'production' branch. git config --unset branch.<branch>.remote git config --unset branch.<branch>.merge That way, you have to mention to what remote you want to pull from (or push to, for that matter). If you define an alias for the pull

Is it possible to push a commit which is not in any branch in git?

谁都会走 提交于 2019-12-12 12:24:41
问题 Locally I can commit without any branch active, i.e. after checking out to a commit but not a branch. Is it possible to push this commit which is not in any branch to remote? EDIT: I'm just wondering theoretically how would git handle pushing a "no-branch" or is pushing only possible with branches. 回答1: When you do git push <remote> <source>:<destination> The <source> can be a commit, yes. The <destination> , however, is a bit more tricky. Take it from the doc : It’s possible to push any type

How to delete something that was accidentally pushed

≯℡__Kan透↙ 提交于 2019-12-12 12:22:10
问题 I wanted to do source control on my website. There were a lot of files so I just went git add -a Unfortunately, I accidentally committed and pushed a file called credentials.txt that had my ftp and db details. I've tried deleting the file, committing then pushing but it still shows the file when I browse my repo on github in the history. Is there anyway to get rid of this? 回答1: Github has a nice guide on this exact topic. It explains how to get it out of the repository, as well as how to deal

How to commit after removing a directory from GIT

纵然是瞬间 提交于 2019-12-12 04:04:11
问题 Several posts talk about removing a file or directory from GIT - but they don't go as far as explaining how to PUSH those changes into the main repository. For example, this works just fine to remove the directory but when I try to PUSH this change to the main Git repo, I am denied: ! [rejected] master -> master (non-fast forward) error: failed to push some refs to '/repo/project.git' To prevent you from losing history, non-fast-forward updates were rejected Merge the remote changes before

Undo a git merge when it has been pushed

烈酒焚心 提交于 2019-12-12 02:49:21
问题 How can I undo a merge when I have already pushed to master after merge? Here are my steps: git add -A git commit -m "some message" git fetch origin master:master git rebase master (resolve merge conflicts) git push -f origin my local branch I want to go back to the state where i was at step 2 回答1: You force pushed , meaning you overwrote the changes on a remote. Your computer can't fix it; however, if there is another computer with a local copy before you force pushed, you can force push