I can't push to branch "dev" in Github using CircleCi - github

I am trying to configure autopush to the branch dev in github, using CircleCi. The problem is that I get an error like:
"error: src refspec dev does not match any.
error: failed to push some refs to 'git#github.com:myname/repo.git'.
Exited with code 1".
When I am using git remote -v, I can see:
origin git#github.com:myname/repo.git (fetch)
origin git#github.com:myname/repo.git (push)
And on the github required branch "dev" exists. Below you can see the part of my *yml code for CircleCi that makes everything.
- run:
name: Git config email
command: git config --global user.email "name#mail.ru"
- run:
name: Git config name
command: git config --global user.name "Name"
- run:
name: git remote -v
command: git remote -v
- run:
name: Push to dev
command: git push origin dev --force

git checkout dev and refs/heads/dev appeared, but the command git push origin dev do not pushed changes into git branch "dev".
That would create a local dev branch based by default on origin/dev.
You would need to merge my_branch to dev first before pushing
git merge my_branch
git push
(git push should be enough, since the newly local created branch dev has origin/dev for its upstream branch)

Related

How to push updated files to GitHub from GitHub Actions

I have tried a lot of things but i keep getting this error:
fatal: You are not currently on a branch.
To push the history leading to the current (detached HEAD)
state now, use
git push origin HEAD:<name-of-remote-branch>
This is my action:
- uses: actions/checkout#v2
- name: Commit new version
run: |
git config --global user.name "github-actions[bot"
git config --global user.email "41898282+github-actions[bot]#users.noreply.github.com"
git add -A
git commit -m "Bumping version number"
git push
I fixed it by explicit setting the ref to a branch name. This is not really what i want but will do for now
- uses: actions/checkout#v2
with:
with:
ref: expo-build

How to update code in gitlab

My team committed code to gitlab repository and I need to take those updates. I already clone the project into my local directory but didn't take update before.
For taking update what commands need to run. I already tried pull command and it shows the changed file details but that changes are not applying to the project. For apply the changes any new command needs to run again?
Run following commands for taking the update:
git fetch && git checkout master
git pull
git config --global user.name "demo"
git config --global user.email "demo#gmail.com"
Create a new repository:
git clone https://gitlab.com/demo_test.git
cd demo_test
git switch -c main
touch README.md
git add README.md
git commit -m "add README"
git push -u origin main
Push an existing folder:
cd existing_folder
git init --initial-branch=main
git remote add origin https://gitlab.com/demo_test.git
git add .
git commit -m "Initial commit"
git push -u origin main
Push an existing Git repository:
cd existing_repo
git remote rename origin old-origin
git remote add origin https://gitlab.com/demo_test.git
git push -u origin --all
git push -u origin --tags

Error Deploying Artifact to Github from VSTS

I am trying to build maven project in VSTS using hosted agent.
I want to deploy my artifact to github. task i am using is Powershell. i am getting error "There is no tracking information for the current branch".
but artifcat are deploying to github, But Build Defination is failing.
If the github repo is not empty and you want to keep the commit histories, you can use the script as below:
cd $(Build.ArtifactStagingDirectory)
git init
git config --global user.name name
git config --global user.email ***#gmail.com
git add .
git commit -m "update"
git remote add origin https://username:password#github.com/username/reponame -f
git checkout -b temp
git checkout master
git reset --hard origin/master
git merge temp -X theirs --allow-unrelated-histories
git push -u origin master
If the github repo is empty or you don’t need to keep the commit histories, you can use the script as below:
cd $(Build.ArtifactStagingDirectory)
git init
git config --global user.name name
git config --global user.email ***#gmail.com
git add .
git commit -m "update"
git remote add origin https://username:password#github.com/username/reponame -f
git push -f origin master
And deselect Fail on Standard Error option:

How to push on my development branch on Github

I get an issue when I try to push on my development branch on Github. Actually, I forked the microscopejs repository to update some files...
Command :
git clone https://github.com/tonymx227/microscopejs.git
git add remote upstream https://github.com/tonymx227/microscopejs.git
git fetch upstream
// I updated some files using Sublime Text 2 here
git add . -A
git commit -m 'test'
git push origin development
Issue :
error: src refspec development does not match any.
error: failed to push some refs to 'https://github.com/tonymx227/microscopejs.git'
You haven't create a local development branch.
You only have the remote tracking branch origin/development after your clone.
Do first a:
git checkout -b development origin/development
Then:
git add . -A
git commit -m 'test'
git push -u origin development
Note: you don't need the git remote add upstream step.

branching a git repository

I have been given access to a git repository. I would like to create a new branch to the existing code. I am unable to find proper steps online to do this process. I believe i should first setup the master in git bash and then create a branch. If anyone can give me the sequence of steps to be followed, that would be helpful.
First step is, creating the clone of the remote branch
git clone <git repo> <folder_name>
example:
$ git clone git://git.kernel.org/abc my2.6
change directory to the newly formed directory ie my2.6
$ cd my2.6
Creating a new branch
git branch <branch name>
$ git branch my2.6.14
Go to new branch:
git checkout <branch name>
example:
$ git checkout my2.6.14
The git pro book is a great source to find information and learning about git: http://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging.
First make sure you have cloned the git repository using git clone command. After that you can check the current branch with this command: git branch
You can create new branch using this command: git checkout -b mybranch